On 2012-03-29 19:26, 1T3XT BVBA wrote:
> On 28/03/2012 18:35, Michel Onoff wrote:
>> I'm using iText 2.1.7 (yes, it's old but it's at least unencumbered by
>> licensing problems)
> Then you're out of luck, sorry.
>
I'm out of luck anyway, even with iText 5.2.1.
Just out of curiosity, I tried the brand new latest release of iText but
the result does not change: with the code below (adapted from section
6.2 of the iText book) the OCGs somehow are not transferred correctly.
-----------
PdfReader reader = new PdfReader(pdf);
Document document = new Document(PageSize.A4);
ByteArrayOutputStream os = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, os);
writer.setPdfVersion(PdfWriter.PDF_VERSION_1_5);
document.open();
PdfContentByte cb = writer.getDirectContent();
int n = reader.getNumberOfPages();
for (int i = 1; i <= n; i++) {
PdfImportedPage page = writer.getImportedPage(reader, i);
cb.addTemplate(page, 1, 1);
document.newPage();
}
document.close();
return os.toByteArray();
------------------------------------------------------------------------------
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