Paulo Soares wrote: > Don't forget to set the content length. > > Paulo > > ----- Original Message ----- > From: "Daniel Essin" <[EMAIL PROTECTED]> > To: <itext-questions@lists.sourceforge.net> > Sent: Thursday, December 28, 2006 10:31 PM > Subject: [iText-questions] ByteArrayOutputStream > > >> I'm trying to use iTextSharp to work through the examples in Chapter 17 of >> the >> book. The first example worked perfectly. The second example of writing to >> the >> response object through a ByteArrayOutputStream fails. It fails because >> Acrobat >> complains that the stream should begin %PDF-. >> >> By examining the contents of the stream in the debugger, the reason >> becomes >> clear. The first character of the stream is a 7 instead of a %. I have no >> clue >> why and would appreciate some guidance. >> >> The code is: >> HttpResponse resp = this.Response; >> Document document = new Document(); >> System.IO.MemoryStream baos = new MemoryStream(); >> PdfWriter.GetInstance(document, baos); >> document.Open(); >> document.Add(new Paragraph("Hello World")); >> document.Add(new >> Paragraph(DateTime.Now.ToLongTimeString())); >> document.Close(); >> resp.ContentType = "application/pdf"; >> resp.Write(baos.ToArray()); >> resp.Flush(); >> >> Thank you, >> Dan Essin >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share >> your >> opinions on IT & business topics through brief surveys - and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> iText-questions mailing list >> iText-questions@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/itext-questions >> Buy the iText book: http://itext.ugent.be/itext-in-action/ > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > Sorry for being a bit dense but - could you please give me a hint as to the property name? I can't find any property of resp called content length/
Dan ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/