In some cases it is necessary to add pdf images and graphics to a document. To do this I use PdfImportedPage. Unfortunately the appearance of the image in the final document is not consistent but seems to be influenced by the current graphics state of the document. When I use for example a dashed stroke in the document the strokes in the imported image also become dashed (in the original image they have been defined solid).
A similar issue occurs when text in the imported graphic pdf uses a same font as the text in the document. In the imported pdf all fonts are embedded (the same is true for the final document). In some cases the alignment and spacing of characters differs from the original graphic.
It is not possible to change something in the imported images/graphics. Is there a way to force a PdfImportedPage object to be treated as a seperate, independent pdf without being influenced by graphics state of the document?
A snippet of the code being used:
.....
contentbyte.saveState();
contentbyte.rectangle(0, 0, 200, 200);
contentbyte.clip();
contentbyte.newPath();
PdfImportedPage image = writer.getImportedPage(reader, 1);
contentbyte.addTemplate(image, 1, 0, 0, 1, 0, 0);
contentbyte.restoreState();
.....
Thanks,
Bill
A similar issue occurs when text in the imported graphic pdf uses a same font as the text in the document. In the imported pdf all fonts are embedded (the same is true for the final document). In some cases the alignment and spacing of characters differs from the original graphic.
It is not possible to change something in the imported images/graphics. Is there a way to force a PdfImportedPage object to be treated as a seperate, independent pdf without being influenced by graphics state of the document?
A snippet of the code being used:
.....
contentbyte.saveState();
contentbyte.rectangle(0, 0, 200, 200);
contentbyte.clip();
contentbyte.newPath();
PdfImportedPage image = writer.getImportedPage(reader, 1);
contentbyte.addTemplate(image, 1, 0, 0, 1, 0, 0);
contentbyte.restoreState();
.....
Thanks,
Bill
------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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