1T3XT wrote:
> I don't have the time to look at your code.
> If it were Java, I'd try running it, but I'm not going to translate
> your example to Java on my own time.

This is an easier example:

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

Public Class StampTest

    Public Sub New()

        Dim pdf As PdfReader = New PdfReader("test.pdf")
        Dim stamper As PdfStamper = New PdfStamper(pdf, New
FileStream("testout.pdf", FileMode.Create))

        Dim page As PdfImportedPage = stamper.GetImportedPage(pdf, 1)
        Dim img As Image = Image.GetInstance(page)
        img.ScalePercent(50.0F)
        img.SetAbsolutePosition(0, 0)

        stamper.InsertPage(2, pdf.GetPageSize(1))
        Dim destUnderContent As iTextSharp.text.pdf.PdfContentByte =
stamper.GetUnderContent(2)
        destUnderContent.AddImage(img)

        pdf.SelectPages("2")

        pdf.Close()
        stamper.Close()

    End Sub

End Class

I think Java would look like this:

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.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
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