Take a look at the new PDF Packages feature in iText (and Acrobat 8). Leonard
On Oct 24, 2007, at 1:47 PM, Chris wrote: >> You have two PDFs, one after the other, in the same PDF file. > > Actually that's what we wanted :), but now i restructured the code > according to the Concatenate sample class and it seems to work now. > > But wouldn't it be nice to have an api where you simply put whole, > already existing pdf files into another and have a new one as an > outcome? > This "get number of pages of pdf" and add each page to the result > seemed not very intuitive to me. But i am a itext newbie anyway :) > > Thanks again, > Chris > >> >> Paulo >> >>> -----Original Message----- >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] On >>> Behalf Of [EMAIL PROTECTED] >>> Sent: Wednesday, October 24, 2007 11:44 AM >>> To: [email protected] >>> Subject: Re: [iText-questions] adding several pdfs causes >>> problems (broken, corrupt?) >>> >>> Thanks for you rapid response, Paulo. >>> >>>> First thing to do is to save the pdf to a file in the >>> server instead of >>>> sending it to browser. If it works it's a problem in the >>> way you sending >>>> it to browser. If it still doesn't work post a link to one of those >>>> files for inspection. Your code looks good. >>> >>> Just before sending the byte array back to the browser i >>> simply saved it to a local directory. >>> >>> It's still the same problem. >>> >>> I attached it to this mail. Hopefully it's suitable for inspection. >>> >>> Chris >>> >>> >>> >>>> >>>> Paulo >>>> >>>>> -----Original Message----- >>>>> From: [EMAIL PROTECTED] >>>>> [mailto:[EMAIL PROTECTED] On >>>>> Behalf Of [EMAIL PROTECTED] >>>>> Sent: Wednesday, October 24, 2007 10:50 AM >>>>> To: [email protected] >>>>> Subject: [iText-questions] adding several pdfs causes >>>>> problems (broken,corrupt?) >>>>> >>>>> Hello list, >>>>> >>>>> i am using itext to combine several pdfs to one result pdf. >>>>> The pdf generation is done by a service that >>>>> returns a byte stream back to the browser that requested the >>>>> pdf. From here the user can decide to save >>>>> the pdf or to open it right away. >>>>> >>>>> The service looks like: >>>>> ByteArrayOutputStream generatePDF(params) >>>>> >>>>> My problem is that the resulting pdf is corrupt. Some acrobat >>>>> readers cannot open the file, on my >>>>> mac i can open the file with acrobat8 that flashes a pop up >>>>> for a very short period saying "repairing.." or >>>>> something, with the preview mac-application opening the pdf >>>>> is not possible. >>>>> >>>>> The pdf is composed of 5 separate pdfs. One is "dynamic" as >>>>> it fields are filled with values programatically, >>>>> the other parts are static as they exist already and are >>>>> simply "pasted" after the first dynamic one. >>>>> >>>>> This is how the static pdfs are attached to the result pdf >>>>> (outStream): >>>>> void combinePDFs(OutputStream outStream, InputStream ... >>>>> pdfStreams) throws IOException, DocumentException >>>>> { >>>>> PdfCopyFields copy = new PdfCopyFields(outStream); >>>>> for(InputStream in : pdfStreams) >>>>> { >>>>> if(in == null) >>>>> continue; >>>>> PdfReader r = new PdfReader(in); >>>>> copy.addDocument(r); >>>>> } >>>>> copy.close(); >>>>> } >>>>> >>>>> I am using itext2.0.5 and jdk1.5. The static source pdfs >>>>> already exist, generated by any kind of software in any version, >>>>> the only thing I know is they are pdfs and can be opened by >>>>> acrobat reader. >>>>> >>>>> I attached the whole class that handles the pdf generation, >>>>> maybe someone can >>>>> see a mistake in using the itext api. >>>>> >>>>> Thanks, >>>>> Chris >> >> >> Aviso Legal: >> Esta mensagem é destinada exclusivamente ao destinatário. Pode >> conter informação confidencial ou legalmente protegida. A >> incorrecta transmissão desta mensagem não significa a perca de >> confidencialidade. Se esta mensagem for recebida por engano, por >> favor envie-a de volta para o remetente e apague-a do seu sistema >> de imediato. É proibido a qualquer pessoa que não o destinatário de >> usar, revelar ou distribuir qualquer parte desta mensagem. >> >> Disclaimer: >> This message is destined exclusively to the intended receiver. It >> may contain confidential or legally protected information. The >> incorrect transmission of this message does not mean the loss of >> its confidentiality. If this message is received by mistake, please >> send it back to the sender and delete it from your system >> immediately. It is forbidden to any person who is not the intended >> receiver to use, distribute or copy any part of this message. >> >> >> --------------------------------------------------------------------- >> - >> --- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a >> browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> 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/ > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > 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/ > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ 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/
