问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/10372069/inline-image-data-in-xslfo-apache-fop