Inline image data in XSL:FO / Apache FOP

我只是一个虾纸丫 提交于 2019-12-21 04:12:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!