Flying-Saucer and embedded images

I’m using Flying Saucer library in order to convert a couple of html files to pdf and I reached a problem – it seems that the library was not able to render the base64 embedded images. Inspired by this post, I wrote an implementation of ReplacedElementFactory in order to implement this feature. It will replace only the base64 embedded images – all the other elements are going to be handled by the default factory.

You have to configure the renderer in order to use the factory:

ITextRenderer renderer = new ITextRenderer();
SharedContext sharedContext = renderer.getSharedContext();
renderer.getSharedContext().setReplacedElementFactory(
new ITextExtendedReplacedElementFactory(
sharedContext.getReplacedElementFactory(),
sharedContext.getDotsPerPixel()));

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>