Billy Anachronism wrote:
> When I run this I get a blank pdf with 1 page.
> If I comment out pdf.SelectPages("2") I get a pdf with 2 pages and
> content on both
(snip)
> PdfReader reader = new PdfReader("test.pdf");
> PdfStamper stamper = new PdfStamper(reader,new 
> FileOutputStream("testout.pdf"))
> 
> PdfImportedPage page = stamper.GetImportedPage(pdf,1)
> Image img = Image.GetInstance(page)
> img.ScalePercent(50.0F)
> img.SetAbsolutePosition(0,0)
> 
> stamper.InsertPage(2, pdf.GetPageSize(1))
> PdfContentByte destUnderContent = stamper.GetUnderContent(2)
> destUnderContent.AddImage(img)
> 
> pdf.SelectPages("2")
> 
> pdf.Close()
> stamper.Close()
> 
> I really don't understand why this is happening.

I finally had a look at this problem and I now see that
you're sawing off the branch you're sitting on.
The Form XObject that is supposed to be on page 2 is removed
before it can be reused. You should redesign your code.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to