简体   繁体   中英

Embed HTML paragraphs in xsl-fo/fop

I'm currently considering using xsl-fo/fop to generate PDFs out of my Java web application. Parts of the content to be printed are "HTML fragments" (TinyMCE editor in web frontend) from different sources.

Is there a way to "embed" HTML into FOP?

I want to avoid an xslt transformation for individual paragraphs containing HTML fragments (the doc contains a lot of other content as well). The alternative is to create one HTML/XML document containing all the paragraphs and other content and then apply an xslt transformation over everything, but somehow I'd like to avoid this if possible.

Note: I also considered HTML to PDF engines (eg Prince) but they seem to be ludicrously expensive.

Thanks!

No, FOP's only valid input is an XSL-FO file (or XML + XSLT producing XSL-FO, but that's just a convenience option as it's an external library that performs the transformation).

However, you can use / adapt an existing xhtml to FO stylesheets , like those provided by AntennaHouse and RenderX .

Besides, even if you say you don't want to do it, writing an xhtml -> XSL-FO transformation is not a daunting task ; this is especially true if the input comes from TinyMCE, as you can configure it to allow only a limited subset of tags, which will require a small set of templates.

(disclosure: I'm a FOP developer, though not very active nowadays)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM