I've got simple img tags working in our headless server application
(running in a servlet container):
<img src="file://whatever/foo/bar.jpg"/>
Images can be read off disk and rendered to the output pdf document.
Great.
Now, a lot of images in our system are generated dynamically via
servlets. This means the web frontend requests e.g.:
<img src="/imageServer?foo=bar"/>
The 'imageServer' endpoint generates image data, returning an
appropriate Content-Type etc header.
How should I go about being able to use that kind of URL in an xhtml
document input to flyingsaucer?
I don't know if it's flyingsaucer that actually resolves these URLs
and fetches the images data, or iText. I've found
http://markmail.org/message/w7i6jbdv3he3aqya where a discussion seems
to cover resource loading in the context of rendering to a Swing
panel. That's not my situation.
A random guess at the API revealed:
ITextRenderer renderer = new ITextRenderer();
SharedContext sc = renderer.getSharedContext();
sc.setUserAgentCallback(new NaiveUserAgent(device))
However I don't have a Device handle, I'm simply trying to call
renderer.layout()/createPDF() to get a PDF document. Any actual
Device and rendering context mechanisms seem to be hidden from me by
the flyingsaucer facade.
Can I provide either flyingsaucer or iText with a custom object which
will resolve URLs itself and return the image data to render, or can I
use true HTTP URLs in my <img> tags, or what? I'm a bit lost as to
where to go with this.
Thanks
Nick