On 2012-04-02 13:33, Leonard Rosenthol wrote: > 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 >
Thanks for the explanation about the behavior of iText imported pages and why they don't support OCGs. I tried the alternative with PdfStamper. This, in fact, preserves the optional contents. It is unclear, though, how to rescale the pages to fit a fixed page size (A4 in my case). PdfStamper itself seems not to expose methods to do this. I unsuccessfully tried to modify the boxes of the underlying PdfWriter, just after the creation of the stamper. As far as I've found, the examples in the book use imported pages to rescale and combine them. Is it possible to use PdfStamper and still achieve page rescaling while preserving optional content? ------------------------------------------------------------------------------ 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
