I am combining 50+ different single page PDF files together that have
been produced from various places (Excel, acrobat, word, etc). The
files combine together no problem, the only issue is that the filesize
is 10-11mb while if I combine the same set of files together using the
acrobat tool the end result is only 1mb.
Am I missing some sort of optimization method within iText to produce
a smaller PDF?
Here is a rough outline of the method I am using that I got out of
examples from the iText in action book:
writer = new PdfWriter.getInstance();
foreach (page) {
PdfReader reader = new new PdfReader(page.getContentsByteArray());
PdfImportedPage importedPage = writer.getImportedPage(reader, 1);
PdfContentByte cb = writer.getDirectContent();
cb.saveState();
cb.doSomeScalingAndAffineTransForms();
cb.addTemplate(importedPage,0,0);
cb.restore();
writer.freeReader(reader);
}
Is the large file size due to the fact I am freeing the reader after I
read each page so the writer is unable to re-use resources like
embedded fonts? Or are there other ways I can optimize the final
output file size?
Thanks.
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php