> We have been using FOP in production to generate reports with Oracle's XSQL
> servlet for about 1 month now and it has been working great. Our next
> project is a photo ID class roster. The system is pretty much set but right
> now the main thing holding us back is the size of the resulting PDF
> document. An 8 page PDF with 30 1.5in x 1.13in jpegs on it is 7.18MB.
> Considering the 240 images used in this document only occupy 730KB this is
> rather large. The only other data in the document is a header and each
> persons name. From what I have read on the FOP mailing list over the past
> few months I seem to remember something about the cause of this being the
> way Sun's JDK handled the images internally. I was also wondering if anyone
> was working on incorporating some kind of image compression into FOP?

Currently all images are decoded into memory as an uncompressed array of
pixels which then get written (and compressed) to the target file. For
PDF the compression is ZLib (Flate/Deflate). For JPEG this is very
inefficient. Theoretically, PDF supports the embedding of native JPEG
files. This is described in the PDF specs. The clue now would be to
write code that bypasses the decompression/compression phases that
happen at the moment. That will probably cause changes in the
org.apache.fop.image and org.apache.fop.render.pdf packages.

I've once started looking into it but never got enough time to really
implement it. I'll be away on holidays the next two weeks so I'm not
much of a help right now.

I can only give some pointers, though:
- The PDF spec contains information on how to implement JPEG-embedding.
- JPEG-support in PDF is very similar to JPEG-support in PostScript.
- And for PostScript there is a demo application on how to embed a JPEG
image in a PostScript file. This can be easily adapted to PDF. See the
link below.
- There's a JPEGReader class that's already parsing the JPEG headers
(org.apache.fop.image.analyser.JPEGReader).

By the way, your request is already on the todo list.

PDF specs at:
http://partners.adobe.com/asn/developer/acrosdk/docs.html

JPEG2PS at (in German):
http://www.pdflib.com/jpeg2ps/

Good luck!

Jeremias Märki

mailto:[EMAIL PROTECTED]

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - 6002 Luzern
Fon +41 (0)41 317 2020 - Fax +41 (0)41 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to