Hi everyone,
Please disregard my question below. I found the problem. I was opening
the large PDF this way:
// --- Open Base PDF --- //
PDFreader = new PdfReader(new
RandomAccessFileOrArray(PDFfile), null);
When it attempts to split the 22,000 page PDF in to 11,000 smaller
PDF's, it takes forever (10+ hours). Then I changed the open to be this:
// --- Open Base PDF --- //
PDFreader = new PdfReader(PDFfile);
When I opened the PDF this way, it flew. It finished processing in 15
minutes! Huge difference.
I guess there was way too much file IO going on when using the
RandomAccessFileOrArray. I really needed to load the entire PDF into
memory. Oh well, live and learn.
Take care everyone.
Alex
Alex Kruzic
Application Development Analyst, Document Solutions Department
Broadridge
Investor Communication Solutions, Canada
5970 Chedworth Way
Mississauga, ON L5R 4G5
Tel: (905) 507-5100 x 55204
Fax: (905) 507-5350
[email protected] <mailto:[email protected]>
________________________________
From: Kruzic, Alex x55204
Sent: May 5, 2009 12:48 PM
To: '[email protected]'
Subject: Imported PDF pages are too slow
Hi everyone,
I am having a performance issue with iText that I need help with. All I
want to do is pull out various pages from a large PDF to create many
smaller PDF's. For my test, the large PDF is 22,000 pages, and I'd like
to split it such that every two pages or so is placed in to it's own
PDF. So it would generate 11,000 PDF's aprox. The problem is that it
takes over 9 hours. I've isolated it down to the writer's
".getImportedPage()" function. When I take that function out, it
produces 11,000 PDF's in 7 minutes! I've tried pdfCopy, pdfStamper,
adding the template, wrapping the page in an image object, and the
performance is still poor. Does anyone know how to do this more
efficiently?
This is how I'm splitting the PDF, and it's very slow:
PdfImportedPage page = null;
PdfContentByte cb = PDFwriter.getDirectContent();
page = PDFwriter.getImportedPage(PDFreader, iPages);
cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
I tried using the image object, and it seems to be a bit faster but not
much.
PdfImportedPage page = PDFwriter.getImportedPage(PDFreader, iPages);
Image image = Image.getInstance(page);
PDFdoc.add(image);
Thanks.
Alex
This message and any attachments are intended only for the use of the addressee
and
may contain information that is privileged and confidential. If the reader of
the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/