We used the examples to create a pdf merge program.  We have a one-page PDF,
26Mb in size that contains an image.  It is taking 7-8 minutes to merge this
PDF.  We have written a tiny java app that demonstrates the problem.  We
stripped the test app down so that it is only processing one input file so
that it is now really only "merging" one PDF into a new PDF.  So... the app
is only processing a one-page PDF (albeit big pdf) and it is taking 7-8
minutes to complete.   Any help would be GREATLY appreciated to determine
why it is taking this long and whether there is any way to fix this.

The input PDF can be found at:  http://home.fuse.net/mikebrungs/test.pdf 
and the source code is shown below:


import java.io.File;
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfCopy;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfReader;
import java.util.Date;

public class PdfTest
{
   public static void main(String[] args)
   {    
      try
      {
         // input file
         File pdfFile = new File(args[0]);

         // copied file being created
         File outFile = new File(args[0] + ".Copied.pdf");

         System.out.println("Input file is: " + args[0]);
         System.out.println("Output file is: " + args[0] + ".Copied.pdf");
         System.out.println("starting at: " + new Date().toString());

         PdfReader reader = new PdfReader(pdfFile.getPath()); 

         reader.consolidateNamedDestinations();
         int numPages = reader.getNumberOfPages();

         Document document = new
Document(reader.getPageSizeWithRotation(1));
         PdfCopy writer = new PdfCopy(document, new
FileOutputStream(outFile.getPath()));

         document.open();

         PdfImportedPage page;

         for (int j = 1; j <= numPages; j++)
         {
            page = writer.getImportedPage(reader, j);
            writer.addPage(page);
         }

         reader.close();
         writer.close();
         writer.freeReader(reader);

         System.out.println("finishing at: " + new Date().toString());
      }
      catch (Exception t)
      {
         t.printStackTrace();
      }
   }
}



-- 
View this message in context: 
http://www.nabble.com/One-page-PDF-takes-7-8-minutes-to-merge----tf4318146.html#a12295586
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to