[poppler] another problem with saving linearized files

Albert Astals Cid aacid at kde.org
Thu Jun 9 11:04:53 PDT 2011


A Thursday, June 09, 2011, Axel Strübing va escriure:
> 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.

Please, send a patch, will make everyone lives easier. And also send a PDF and 
some code to prove your patch has benefits at least for a given case.

Albert

> --
> regards
> Axel
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler


More information about the poppler mailing list