Hi guys.

Taking 1T3XT BVBA's advice, I'm trying to walk through using PDFStamper just to 
output a pdf file that is copied from another pdf.

Here's what I have:

    Protected Sub GeneratePDFWithText(ByVal sender As Object, ByVal e As 
EventArgs)

        Dim fileName As String = "pdfDocument" & DateTime.Now.Ticks & ".pdf"
        Dim sourcepdf As String = 
System.AppDomain.CurrentDomain.BaseDirectory() & 
"SourcePDFs\CRM1008-01-MoreRefLtr.pdf"
        Dim reader As PdfReader = New PdfReader(sourcepdf)
        Dim stamp As PdfStamper = New PdfStamper(reader, Response.OutputStream)
        

        Response.Clear()

        Dim content As PdfContentByte = stamp.GetUnderContent(1)

        stamp.Close()

        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", "attachment filename=" + 
fileName)
        Response.Flush()
        Response.End()

    End Sub

The product of this sub is a pdf, but when I open it I get a message that reads:

"Adobe Reader could not open 'PDFGeneratorVB.pdf' because it is either not a 
supported file type or because the file has been damaged."

Any thoughts on why this might be?

Thank you in advance, and I apologise for the ignorant question.


      

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

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