I'm afraid this one boils down to "Doc, it hurts when I do this".
 
Then Don't Do That.
 
If a particular page depends on a default value rather than explicitly
setting it, and that value is set prior to drawing the PdfImportedPage,
then the exlicit value will "leak through".
 
This is where the proper use of saveState/restoreState comes in.  Going
by your sample code, you've mostly got the idea already.  You just need
to restoreState all the way back to the default state before doing your
clipping and drawing your imported page.
 
 
 
--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 


________________________________

        From: Bill Groom [mailto:bgr...@razcall.com] 
        Sent: Wednesday, May 25, 2011 2:04 AM
        To: itext-questions@lists.sourceforge.net
        Subject: [iText-questions] Appearance of PdfImportedPage object
inconsistent
        
        
        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
        

------------------------------------------------------------------------------
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

Reply via email to