XSL:FO/Apache FOP中的嵌入式图像数据 [英] Inline image data in XSL:FO / Apache FOP
问题描述
我有要使用XSL:FO转换为PDF的MIME多部分数据.我很舒服使用
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.
我想要做的是在XSL:FO转换的PDF输出中具有一个元素(或一组元素)来呈现图形(JPG/PNG/GIF-全部或其中的一些).图形数据应作为Base64(或其他)编码数据包含在.fo文件的内部中.我发现了如何指向外部图形,但与嵌入式图形数据无关.
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.
那将如何工作?
推荐答案
元素fo:external-graphic
也可以用于嵌入内联数据.只需使用以下语法:
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>
应该替换为JPEG图像的base64数据字符串.
<DATA>
should be replaced with your base64 data string of the JPEG image.
这篇关于XSL:FO/Apache FOP中的嵌入式图像数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!