[opencms-dev] Generating PDFs out of a page and/or XML content

Christian Steinert christian_steinert at web.de
Thu Sep 14 13:29:04 CEST 2006


Dear Corsin,

HTML is too big/complicated (especially, when you consider CSS), so
transforming HTML to PDF will never be easy and it will require either
lots of work or it will bring weak results or a mixture of both. There
are probably some commercial solutions that try to convert HTML into
PDF, but I cannot suggest anything.
__

If you have the information in a structured manner (that means: XML),
then that would be much better. And if you want to transform XML to PDF,
then using XSLT and FOP is a very appropriate way of handling things, at
least if you're somewhat comfortable with XSLT.

And it should be not so hard to find documentation on XSL:FO (that is an
XML-format for expressing paged documents and it's used by FOP and other
similar processors as input format) and samples for calling FOP. Of
course, you can also use sth. like itext to assemble your pages with
Java code, but imho an approach based XSLT/XSL-FO is much more
appropriate for most tasks where XML needs to be transformed into PDF
(or other paginated formats for that matter).


If your content is valid XHTML, and you are happy with only some simple
HTML stuff being represented in PDF, then there also are some XSLTs on
the net  that do a XHTML - to - XSL-FO transformation (and then, you
would have to use sth. like FOP again). Antennahouse had made some XSLTs
available for this some years ago. They are probably pretty basic and I
don't know if FOP will fully suppport all the formatting that they use
(Antennahouse is producer of a commertial XSL-FO - to - PDF processor). 
If you are interested, you could search for "Antennahouse XSLT HTML XSL
FO" you should find them.

regards
christian
>
>
> I need a solution to generate a PDF out of a page my users can
> generate. Like www.mysite.com/mypage.html
> <http://www.mysite.com/mypage.html> and a print link should link to
> the PDF version. Does anybody know if there is a simple solution (like
> a HTML2PDF or simply a template) or do I have to use iText and rebuild
> the page?
>
> For any help or responses I am very thankful
>
> Regards
> Corsin
>
> -- 
> Corsin Camichel
> cocaman at gmail.com <mailto:cocaman at gmail.com>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060914/e3fb7d3c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3269 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060914/e3fb7d3c/attachment.bin>


More information about the opencms-dev mailing list