Thank you Paulo for your feedback!  I will research MemoryStream and see if I 
can make that work.  

C

--- On Mon, 2/28/11, Paulo Soares <psoa...@glintt.com> wrote:


From: Paulo Soares <psoa...@glintt.com>
Subject: Re: [iText-questions] PDF Stamper creates damaged file?
To: "Post all your questions about iText here" 
<itext-questions@lists.sourceforge.net>
Date: Monday, February 28, 2011, 2:29 PM





Create the doc to a MemoryStream, set the content length and output the 
MemoryStream to the Response.OutputStream. IE is very picky, Firefox will do 
better.
 
Paulo

----- Original Message ----- 
From: Craig Hodder 
To: iText-questions@lists.sourceforge.net 
Sent: Monday, February 28, 2011 7:39 PM
Subject: [iText-questions] PDF Stamper creates damaged file?

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&#174; 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
-----Inline Attachment Follows-----


------------------------------------------------------------------------------
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 
-----Inline Attachment Follows-----


_______________________________________________
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


      
------------------------------------------------------------------------------
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&#174; 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