On May 18, 2008, at 06:10, Ted Young wrote:

Hi


I am using FOP version 0 .94 under Java 1.6 update 6.

I am using FOP to create a PDF dictionary from a source XML file. There are only 12,000 entries in this dictionary. The tricky bit is that the words being defined are in Ancient Egyptian Hieroglyphs. Each word (or phrase) is stored in SVG format. So ultimately my FO document contains 12,000 instream-foreign-object tags each containing SVG. This configuration alone taxes the 1 GB memory limit I am able to give to my virtual machine (a known issue with running Java under Windows).

Each dictionary entry would like to contain zero or more alternative words and phrases (think thesaurus). This increases the number of instream-foreign-object tags containing SVG to the order of 30,000 or 40,000. Even breaking this up into individual chapters I have a very hard time rendering these documents. They consume vast amounts of memory and bring my system to a halt even under Linux.

Breaking up the document into chapters will not save /very/ much if there are a lot of cross-references, especially when they point forward to later chapters...

So I was wondering if anyone had any suggestions on how I could optimize my FO document and use of SVG. Since all of the "see also" words and phrases can be found elsewhere in my document is there a way to generate a PDF-layer reference to content located at another part of a document? I am thinking of something analogous to symbols in Flash; a way of having FOP render the SVG word or phrase once and have it instruct the PDF to reuse that content in many locations.

If you would insert the SVG as fo:external-graphic and the source URI for the image is the same, it should normally be re-used at the other places it is referenced. Since fo:instream-foreign-objects do not have a URI, I don't think this allows for any internal caching/re- using of the images... I'm not 100% certain, but I think using i-f-o currently means that inserting the same SVG 1000 times would lead to 1000 separate SVG DOMs as foreign nodes in the FO tree (?)

Trying external-graphic would, of course, require an extraction of all the SVG that is currently put in fo:instream-foreign-object to separate files. If you don't already have separate files, then as a tryout, this could probably be done by applying an XSL transform to your current FO document, replacing fo:instream-foreign-object with fo:external- graphic, and using extensions to produce one output document per encountered SVG.

Taking care of duplicates may turn out to be a challenge with this approach, though...

If you already retrieve the SVG from separate files, or from a database, you could adapt the stylesheet to produce fo:external- graphic instead, and pass it the URI that is used as a source.


HTH!

Andreas

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

Reply via email to