Hello!

I'm afraid I stumbled on a bug.

I have to add an an annotation to a page in an existing PDF in append mode;
the /Contents array of that page happens to contain a reference to the same
stream twice:

4 0 obj
<<
/Type /Page
[...]
/Contents [36 0 R 36 0 R 35 0 R 77 0 R]
>>
endobj 

Therefore, I create a PdfReader reading that file. This implies a readPdf()
call which in turn after reading the PDF objects into internal structures
calls eliminateSharedStreams().

eliminateSharedStreams() finds that very page and changes its internal
representation of the /Contents array to

/Contents [36 0 R 96 0 R 35 0 R 77 0 R] 

(96 being the first free object number) and adds an object 96 0 to its
internal structures.


Ok, after creating the PdfReader I create the PdfStamper in append mode and
add the annotation to that very page. This especially has the effect that
the page dictionary object 4 0 obj is internally marked as used in the
PdfStamper; the object 96 0 obj is not, though.

Thus, when closing the PdfStamper the resulting PDF contains a manipulated
page dictionary object 4 0 obj whose /Contents array references the object
96 0 obj which unfortunately did not make it into the resulting PDF. The
resulting PDF therefore is broken.

Unfortunately I'm not permitted to post that PDF here. I'll try and create
an example PDF soon.

Regards,   Michael.

-- 
View this message in context: 
http://old.nabble.com/Problem-with-PdfReader.eliminateSharedStreams%28%29-in-concert-with-appending-PdfStamper-tp26734822p26734822.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to