Hi,
i'm willing to reduce the size of my PDF (generated with iText-1.3 on Java).
I'm using existing PDF template file with internal fields (form). I fill
them using AcroFields, with a PdfStamper.
My final PDF weighs about 350Ko.
I tryied the following code to compress the file size :
final PdfStamper stamper = new PdfStamper(reader, baos,
PdfWriter.VERSION_1_5, false);
[...]
stamper.setFormFlattening(true);
stamper.setFullCompression();
stamper.close();
But i only gain about 10Ko less on my final file.
Then i tested these lines to remove unused objects from my PDF file :
stamper.getReader().removeAnnotations();
stamper.getReader().removeFields();
stamper.getReader().removeUnusedObjects();
Here, i managed to reduce the file size by 200Ko (file size: 130Ko -
Great!). But the down side is that my file isn't well formed anymore. I've
got an error from my PDF viewer when opening the file (Acrobat reader says
"This file contains an error..."), and the text shown in the PDF contains
bad encoded characters (the text is in French and contains some accents ('È
' instead of 'é', '‡' instead of 'à').
My question is: Is there any way to reduce the size of a PDF file without
corrupting it ?
Any help would be appreciated. I really need to decrease the size of these
generated PDF files. I tryied to print my PDF into another PDF using
PDFCreator (just for test) and the size decreased from 350Ko to 244Ko
without any loss in the PDF file. So i think there have to be a way to do so
with iText, isn't it?
Thanks!
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/How-to-reduce-size-of-PDF-with-form-fields-tp3356683p3356683.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
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