I'm interested in implementing merging of duplicate subset fonts in Jeremias's fop-pdf-image extension. I'm working with fop 1.0, and i'm having trouble with two things:

- A clean way to associate data that's private to the image processing plugin with a particular rendering run so I can access it across multiple invocations of the plugin; and

- How to append some additional PDF objects after the last page is emitted but before the PDF document trailer and final xref table(s) are written out.

I think I've figured out how to associate private image plugin data with the document being rendered (using the RenderContext as a key to a static WeakHashMap in the plugin) but it seems like a pretty ugly approach, so I'm hoping there's a better way I'm missing.

More problematic is that I need to emit additional PDF objects after the last page - or at least the last image - has been rendered. I can't see any obivous callbacks to fop image plugins to notify them when a new document is started, a new page started, a page finished or a new document finished. Fop seems to have an event system but it seems to be oriented toward trapping error conditions and problems rather than doing extra work at certain processing phases. In particular, PDFEventProducer doesn't seem to be useful for this.

Any advice on how to hook document completion after the last page is written but before the pdf trailer and other closing pdf structure are written, so I can write out some indirect objects I've only written indirect references to so far?

Sorry if these are somewhat stupid questions. I'm very new to fop's codebase and I'm still getting my head around it.

Craig Ringer

Reply via email to