If you read the section of the PDF Reference that you quoted earlier in this thread, you will see that OC sits in THREE PLACES in the PDF.
1 - Page Content 2 - Page Resources 3 - Catalog By doing the "imported page" bit, you are only getting #1 & #2, but completely missing #3. Hence your problem. By using the PdfStamper, as has been suggested to you, you will get all three. The alternative is for you to write a bunch of code to handle #3 yourself on your existing copying model. Of course, your model also tosses LOTS of other stuff such as tagged PDF, metadata, etc. Leonard -----Original Message----- From: Michel Onoff [mailto:[email protected]] Sent: Monday, April 02, 2012 5:51 AM To: [email protected] Subject: Re: [iText-questions] copying layers (OCG) On 2012-04-02 11:35, iText Info wrote: > Op 2/04/2012 11:09, Michel Onoff schreef: >> The original docs are not always syntactically and structurally 100% >> correct. Thus, I rely on PdfReader tolerance to parse them anyway >> when possible and on PdfWriter (or PdfStamper?) to produce correct syntax. > Now I remember. Didn't Leonard Rosenthol (Adobe's PDF architect) > already explained that your approach was completely wrong? PdfStamper > is what you need. Also: don't bite the hand that feeds you. > Yes, he explained that my approach is wrong. Unfortunately, he forgot to explain why it is wrong and what one can do to ameliorate it. Besides, I still haven't got technical clues on why OCGs already present in the original docs are not processed correctly. But, as I said, I'll try with PdfStamper. ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
