Hi all,

> 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
> 

as it was not as clear as possible in the first message, I want to clarify 
that the problem is in saving a modified file incrementally by giving  
writeForceIncremental flag to PDFDoc->saveAs. The problem occurs only if the 
file is linearized.

I attached a patch, which modifies the original behaviour of getStartXRef for 
the case that the file is linearized. With the patch applied my application 
modifies the file okay.

I also attached the original (test2.pdf) and modified files before and after 
applying the patch, respectively.

openTest.pl uses CAM::PDF and demonstate my problem. It opens test2.pdf and 
test2-afterPatch.pdf okay but not test2-beforePatch.pdf

If I could assist you any further don't hesitate to contact me.

--
regards
Axel
--- PDFDoc.cc_org	2010-12-27 21:44:28.000000000 +0100
+++ PDFDoc.cc	2011-06-10 09:30:49.671632440 +0200
@@ -1089,6 +1089,6 @@
       startXRefPos = 0;
       for (i = 0; i < n; i++) {
-        if (!strncmp("endobj", &buf[i], 6)) {
-           startXRefPos = i+6;
+        if (!strncmp("xref", &buf[i], 4)) {
+           startXRefPos = i;
            break;
         }

Attachment: test2-afterPatch.pdf
Description: Adobe PDF document

Attachment: test2-beforePatch.pdf
Description: Adobe PDF document

Attachment: test2.pdf
Description: Adobe PDF document

Attachment: openTest.pl
Description: Perl program

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to