pdf-rewriter.raku failing to rewrite PDF 1.5 with /XRef and /ObjStm objects
Closed this issue · 0 comments
dwarring commented
If I read and write such a PDF:
$ raku -I . bin/pdf-rewriter.raku t/pdf/samples/pdf-1.5-obstm_and_xref_streams.pdf /tmp/out.pdf
opening t/pdf/samples/pdf-1.5-obstm_and_xref_streams.pdf ...
saving ...
done
Then GS no longer works on it:
gs /tmp/out.pdf
GPL Ghostscript 9.50 (2019-10-15)
Copyright (C) 2019 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
**** Error: An error occurred while reading an XREF table.
**** The file has been damaged. This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
**** However, the output may be incorrect.
**** Error: Trailer dictionary not found.
Output may be incorrect.
No pages will be processed (FirstPage > LastPage).
**** This file had errors that were repaired or ignored.
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
**** The rendered output from this file may be incorrect.
GS>
The /Index
entry in the /XRef
is obviously wrong suspicious, and should probably be sorted anyway : [/Index [ 0 1 12 1 19 1 24 ...]