Document document = new Document(); ByteArrayOutputStream ba = new ByteArrayOutputStream(); PdfWriter.getInstance(document, ba); ... document.close(); PdfReader cover = new PdfReader(ba.toByetArray());
Best Regards, Paulo Soares > -----Original Message----- > From: Richard Corfield [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 24, 2004 4:02 PM > To: Paulo Soares; [EMAIL PROTECTED] > Subject: RE: [iText-questions] Concatenating an existing PDF > with a new document in a servlet. > > Paul > > Thankyou for your reply. This narrows my problem down to the > fact that I'm not sure how to create a new document as a byte > array. Previously I have used something like: > Document document = new Document() > PdfWriter.getInstance(document, new > FileOutputStream("3.pdf")); > ...which (obviously) writes to file. > Can you give me an example of creating a document as a byte > array in memory. Apologies if this is trivial - I do not > normally work in java > > Many thanks. > > Regards > > Richard > > On Thu, 24 Jun 2004 15:44:46 +0100, Paulo Soares wrote: > > Create your cover page in memory. Now you can concatenate > two documents: > > one created with PdfReader(byte[]) and the other from > PdfReader(String). > > > > Best Regards, > > Paulo Soares > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On > > > Behalf Of Richard Corfield > > > Sent: Wednesday, June 23, 2004 12:00 PM > > > To: [EMAIL PROTECTED] > > > Subject: [iText-questions] Concatenating an existing PDF with > > > a new document in a servlet. > > > > > > Hi > > > > > > I am trying to create a cover sheet dynamically to existing > > > PDFs using a servlet. > > > All I want to do is put an extra page at the front of the PDF > > > with some simple text and then stream directly to the browser. > > > > > > I can concatenate existing files and then print then to the > > > browser. And I can create new documents, but I'm having > > > trouble doing both at once. > > > > > > Would it be possible for someone to post a very simple > > > example of this in action? > > > > > > Many thanks > > > > > > Richard > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email sponsored by Black Hat Briefings & Training. > > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > > > digital self defense, top technical experts, no vendor pitches, > > > unmatched networking opportunities. Visit www.blackhat.com > > > _______________________________________________ > > > iText-questions mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions