COSWriter.java (pdfbox-2.0.23-src) | : | COSWriter.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 590 | skipping to change at line 590 | |||
* | * | |||
* @param doc The document to get the data from. | * @param doc The document to get the data from. | |||
* | * | |||
* @throws IOException If there is an error writing to the stream. | * @throws IOException If there is an error writing to the stream. | |||
*/ | */ | |||
protected void doWriteHeader(COSDocument doc) throws IOException | protected void doWriteHeader(COSDocument doc) throws IOException | |||
{ | { | |||
String headerString; | String headerString; | |||
if (fdfDocument != null) | if (fdfDocument != null) | |||
{ | { | |||
headerString = "%FDF-"+ Float.toString(doc.getVersion()); | headerString = "%FDF-"+ doc.getVersion(); | |||
} | } | |||
else | else | |||
{ | { | |||
headerString = "%PDF-"+ Float.toString(doc.getVersion()); | headerString = "%PDF-"+ doc.getVersion(); | |||
} | } | |||
getStandardOutput().write( headerString.getBytes(Charsets.ISO_8859_1) ); | getStandardOutput().write( headerString.getBytes(Charsets.ISO_8859_1) ); | |||
getStandardOutput().writeEOL(); | getStandardOutput().writeEOL(); | |||
getStandardOutput().write(COMMENT); | getStandardOutput().write(COMMENT); | |||
getStandardOutput().write(GARBAGE); | getStandardOutput().write(GARBAGE); | |||
getStandardOutput().writeEOL(); | getStandardOutput().writeEOL(); | |||
} | } | |||
/** | /** | |||
skipping to change at line 715 | skipping to change at line 715 | |||
getStandardOutput().write(XREF); | getStandardOutput().write(XREF); | |||
getStandardOutput().writeEOL(); | getStandardOutput().writeEOL(); | |||
// write start object number and object count for this x ref section | // write start object number and object count for this x ref section | |||
// we assume starting from scratch | // we assume starting from scratch | |||
Long[] xRefRanges = getXRefRanges(getXRefEntries()); | Long[] xRefRanges = getXRefRanges(getXRefEntries()); | |||
int xRefLength = xRefRanges.length; | int xRefLength = xRefRanges.length; | |||
int x = 0; | int x = 0; | |||
int j = 0; | int j = 0; | |||
while (x < xRefLength && (xRefLength % 2) == 0) | if ((xRefLength % 2) == 0) | |||
{ | { | |||
writeXrefRange(xRefRanges[x], xRefRanges[x + 1]); | while (x < xRefLength) | |||
for (int i = 0; i < xRefRanges[x + 1]; ++i) | ||||
{ | { | |||
writeXrefEntry(xRefEntries.get(j++)); | writeXrefRange(xRefRanges[x], xRefRanges[x + 1]); | |||
for (int i = 0; i < xRefRanges[x + 1]; ++i) | ||||
{ | ||||
writeXrefEntry(xRefEntries.get(j++)); | ||||
} | ||||
x += 2; | ||||
} | } | |||
x += 2; | ||||
} | } | |||
} | } | |||
/** | /** | |||
* Write an incremental update for a non signature case. This can be used fo r e.g. augmenting | * Write an incremental update for a non signature case. This can be used fo r e.g. augmenting | |||
* signatures. | * signatures. | |||
* | * | |||
* @throws IOException | * @throws IOException | |||
*/ | */ | |||
private void doWriteIncrement() throws IOException | private void doWriteIncrement() throws IOException | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 11 lines changed or added |