Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline image data in XSL:FO / Apache FOP

I have MIME Multi-Part data that I want to convert to PDF using XSL:FO. I'm comfortable reading MIME using Apache James and I have a grasp on embedded image data in Mime or inline images in HTML. I diligently searched SO for "[xsl-fo] inline graphic" and "[xsl] +html +mime +image" and found somehow the opposite and a precurser what I'm up to. Also Google on "convert HTML MIME to XSL:FO" was inconclusive.

What I want to do is having an element (or a set of elements) that render a graphic (JPG/PNG/GIF - all or some of them) in the PDF output of an XSL:FO transformation. The graphic data should be included inside the .fo file as Base64 (or otherwise) encoded data. I found how to point to external graphics, but nothing about embedded graphic data.

How would that work?

like image 868
stwissel Avatar asked Apr 29 '12 12:04

stwissel


1 Answers

The element fo:external-graphic can be utilized to embed inline data as well. Just use the following syntax:

<fo:external-graphic src="url('data:image/jpeg;base64,<DATA>')"/>

<DATA> should be replaced with your base64 data string of the JPEG image.

like image 84
Martin Avatar answered Sep 28 '22 18:09

Martin