I am using itextshap version 5.0.4.0 to generate a pdf file, to print an output of some data generated by an aspx page In a sumary way, the page have two textboxes and a button I fill some data in textboxes and then click the button to get the output in a pdf window Inside the button click event I have this code
Response.ContentType = "application/pdf" Response.AddHeader("Content-Disposition", "attachment; filename=itext.pdf") Dim doc1 As New Document() PdfWriter.GetInstance(doc1, Response.OutputStream) doc1.Open() doc1.Add( New Paragraph(TextBox1.Text)) doc1.Add( New Paragraph(TextBox2.Text)) doc1.Close() When I click the button, these actions occur 1. I receive the message "Do you want to open or to save this file?" 2. I select Open 3. A little window opens like the one when you download a file, and desappears in a second 4. An Adobe Reader window opens 5. I receive the message "There was an error opening this document. The file is damaged and could not be repaired" How can I solve this? Curiosly, if I send the data to another page and put the code in the load event of this second page, I get the correct output in the Adobe Reader window, but I don't like this long way. Thanks
------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________ 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