If you are using the last iText version and the original concat_pdf then
post the files somewhere for inspection.
Best Regards,
Paulo Soares
----- Original Message -----
From: "Smith, Tim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 21, 2003 20:58
Subject: [iText-questions] Problem concatinating pdfs
> I am trying to concatenate two pdf files, however when the file created
> is opened I get the error 'There was an error opening the document. The
> file is damaged and could not be repaired.'
>
> My code is almost exactly taken from concat_pdf, can anyone see where i
> went wrong?
>
>
>
>
>
> public void generatePDF(FileOutputStream fos)
>
> {
>
> try
>
> {
>
>
>
> int f = 0;
>
> Document document = null;
>
> PdfCopy writer = null;
>
> PdfReader reader = null;
>
> String[] args = {"confirmation01.pdf", "billing01.pdf"};
>
> while (f < 2)
>
> {
>
> reader = new PdfReader(args[f]);
>
>
>
> int n = reader.getNumberOfPages();
>
> System.out.println("There are " + n + " pages in " + args[f]);
>
>
>
> document = new Document(reader.getPageSizeWithRotation(1));
>
> writer = new PdfCopy(document, fos);
>
> writer.setPageCount(2);
>
> document.open();
>
>
>
> PdfImportedPage page;
>
> for (int i = 0; i < n; )
>
> {
>
> ++i;
>
> page = writer.getImportedPage(reader, i);
>
> writer.addPage(page);
>
> System.out.println("Processed page " + i);
>
> }
>
> f++;
>
> }
>
> document.close();
>
> writer.close();
>
> }
>
> catch(Exception e)
>
> {
>
> e.printStackTrace();
>
> }
>
> }
>
>
>
>
>
> Thanks in advance
>
>
>
> Timothy Smith
>
> CGI
>
> 5099 Creekbank Rd.
>
> Phone: (905)282-3532
>
> Cell: (905)866-4970
>
>
>
>
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions