[poppler] another problem with saving linearized files

Axel Strübing axel.struebing at freenet.de
Thu Jun 9 09:53:36 PDT 2011


Dear popplers	

there seems to be a problem in PDFDoc::writeTrailer.

For incremental updating linearized pdffiles  the result of getStartXRef() is 
written as the "/Prev" entry in the trailer dictionary.
The value is determined from the offset after the first 'endobj' string in the 
file. In my example this is not the offset of the expected 'xref' keyword.

Unfortunately the parser/lexer in poppler is more tolerant than other ...
So I have other software that is rejecting the poppler saved files as invalid 
:-(

Could you check if the following change in PDFDoc.cc would do more harm than 
good? It is only used in building the XRef instance.
------------ change following lines ------------
      for (i = 0; i < n; i++) {
        if (!strncmp("endobj", &buf[i], 6)) {
           startXRefPos = i+6;
           break;
        }
      }
------------ to ------------------------------------
     for (i = 0; i < n; i++) {
	if (!strncmp("xref", &buf[i], 4)) {
	  startXRefPos = i;
	  break;
        }
     }

Please correct me if I am wrong and waisted someones time. Of course I'd send 
a patch if needed.
--
regards
Axel


More information about the poppler mailing list