David Woosley wrote:
I used stamper.setFullCompression() just before stamper.close() and I got
the same file size. I noticed there are several classes with the
setFullCompression() method. Was I using the correct one?
If you are creating a document from scratch, you need the method in
PdfWriter;
if you are stamping an existing document, you need the one in PdfStamper,
if you are copying an existing document, you need the one in PdfCopy
(which is a subclass of PdfWriter).
The other setFullCompression methods are used internally.
Observe that you will only benefit from full compression if you
have lots of pages with lots of overhead caused by the PDF syntax
(outlines, annotations, metadata and stuff).
Full compression doesn't compress images.
I am drawing many large images (500K each) into small areas, and I know the
document only requires 300 DPI. So I'll scale them down as BufferedImages
as you mentioned.
I think I'm repeating myself but you have the choice between two options:
1. compress the images before you add them to the PDF using JAI
2. use Graphics2D to convert all images to a JPEG of a user-defined quality
When I use the File --> Reduce File Size command in
Acrobat, it REALLY works. It reduces the file from 5MB to 160K and that's
what I need: A Java class to perform that same trick.
Aha, you need to read this thread to know what happens when you
reduce the file size (Bill Ensley's as well as Leonard Rosenthol's answer):
http://thread.gmane.org/gmane.comp.java.lib.itext.general/20202
I've spent several weeks reviewing these Java/PDF products -- iText, PDFLib,
BFO and a half-dozen more. None of them are perfect, but several are very
good. We've chosen iText for the document manipulation. We're working with
qoppa.com to possibly obtain a purely-Java compression class, and that's
looking good. (We're willing to pay for this stuff if somebody will deliver
what we need.)
You can't compress a PDF beyond what is possible according to the PDF
Reference,
so I think what you really need is something that compresses the images,
not the PDF.
JAI (from SUN) is probably the answer.
Let me ask this: Does the Adobe Developer Network provide access to great
Java APIs and tools? It only costs $1500 to become a member, but it's hard
to tell from their online documentation what you get for that money?
I haven't worked with the SDKs from Adobe, so I really don't know.
There are two places where you can ask this: news://comp.text.pdf (the
newsgroup on PDF)
and here on the mailing list, for instance if Carsten Hammer (?) or
Leonard Rosenthol see
this question.
br,
Bruno
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions