On Monday, 15 August 2022 11:20:10 BST Ralph Corderoy wrote: > Second, gropdf(1) chokes on gm PDF with > > PDF Dict Key 'endstream' does not start with '/' > > so I filter gm's output through ps2pdf(1) first.
I created a random png to pdf with gm convert and it produced a pdf which caused the same error message. Running "qdf --check" on the pdf produced several messages:- checking AJ.pdf PDF Version: 1.2 File is not encrypted File is not linearized WARNING: AJ.pdf (object 11 0, offset 10197): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10207): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10219): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10227): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10234): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10261): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10281): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10301): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10321): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10341): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10361): unknown token while reading object treating as string WARNING: AJ.pdf (object 11 0, offset 10361): too many errors; giving up on readng object WARNING: AJ.pdf (object 11 0, offset 10364): expected endobj So, the problems are with object 11 in the pdf. Here it is:- 11 0 obj << endstream endobj It starts a hash with "<<" but fails to close it with ">>". Each hash entry is a key/value pair where the key is preceded by a "\". The endstream should follow after a stream but that is missing. In fact object 11 is not referenced by any other object in the file so could be dropped completely, which is probably what ps2pdf has done. Interestingly if you use the command "convert file.png file.pdf" a valid pdf is produced which works with gropdf. It may also give a clue what object 11 was intended to be. In the valid pdf it is specified as a thumbnail of the embedded image, but because it is just a single pixel it does not fulfill its role very well! Laurens Wrote:- > true, it's quicker, converting the postscript to pdf takes longer then the > actual formatting. I found the quality of the convert map somewhat lacking > in the pdf example, though. I'll probably stick to what I've got. Does the map have to be a png? If it can be produced in a vector format, i.e. svg, postscript, or even built using groff draw primitives, it will considerably improve the quality of the map and substantially reduce the size of the pdf produced. Cheers Deri