Interesting. It really sounds like the file based approach makes more sense (since the Adobe plug-in can't handle memory-only baos's).
Iliadis mentioned reading the PDF into a ByteArrayOutputStream. However, checking around the book (including chapter 17), I didn't find a simple way to load an existing file-based PDF into a baos. The following example files use baos, but, don't seem to load an existing PDF into one. (probably because it's not useful?) C:\temp\examples\chapter02\HelloWorldAddMetadata.java C:\temp\examples\chapter02\HelloWorldCopyStamp.java C:\temp\examples\chapter02\HelloWorldStampCopy.java C:\temp\examples\chapter02\HelloWorldStampCopyStamp.java C:\temp\examples\chapter17\FoobarCourses.java C:\temp\examples\chapter17\helloworld.jsp C:\temp\examples\chapter17\OutSimplePdf.java C:\temp\examples\chapter17\ProgressServlet.java C:\temp\examples\chapterF\HelloWorldAddMetadata.java C:\temp\examples\chapterF\HelloWorldXmpMetadata.java Thanks in advance. M >From: "Bruno Lowagie (iText)" <[EMAIL PROTECTED]> >Reply-To: Post all your questions about iText here ><[EMAIL PROTECTED]> >To: Post all your questions about iText here ><[EMAIL PROTECTED]> >Subject: Re: [iText-questions] Reading a PDF via a ByteArrayOutputStream? >Date: Fri, 13 Apr 2007 13:43:37 +0200 > >Strange, I received the answer to this question, >but not the original question. Anyhow: > >Iliadis Yannis wrote: > > I for myself read a pdf template (physical file) into a > > ByteArrayOutputStream and pass it to a PdfStamper where I do all the > > manipulation (in your case a PdfWriter object). > >That's an ideal way to do it if you are reusing >the same template over and over again. > > > After that the final pdf (still a ByteArrayOutputStream) is send through > > a web service to the clients web browser. From there the adobe reader > > plug takes over and shows the pdf. > >Yep, but remember that the PDF will be stored somewhere >as a file on the client machine (maybe only temporarily). >Most viewer (certainly Adobe Reader) need the PDF as a >file; Adobe Reader doesn't accept a byte stream from memory. > > > 2007/4/13, Mork Afur <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>>: > > > > In the case where a file-based PDF would have a short life span, we >are > > thinking about just using a ByteArrayOutputStream representation for > > creating and viewing the PDF. > > > > Is this possible? I'm not sure how we'd "view" the > > ByteArrayOutputStream. > > > > Also, there is only one example (in the 297 java examples with the >book) > > that returns a "baos" object. > >In Chapter 2 I explain that you can write to any OutputStream, >including a ByteArrayOutputStream. Point is: how are you going >to send those bytes to a Viewer? >If you really want to keep the documents in memory only, >you could try writing a PDF to a Ramdisk and let the viewer >read it from there. I haven't tried this yet. Do people still >use ramdisk? I feel very old when I use that word... > >br, >Bruno > >------------------------------------------------------------------------- >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 >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/itext-questions >Buy the iText book: http://itext.ugent.be/itext-in-action/ _________________________________________________________________ Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/ ------------------------------------------------------------------------- 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
