Converting DITA to PDF using CSS Paged Media
Historically PDF conversion of DITA content is closely tied to XSL-FO. However there are alternative ways to get from DITA to PDF. The classic XML addicted will likely disagree but going from DITA XML to PDF through CSS Paged Media appears more reasonable and much easier. The first step is to generate a single-source (X)HTML file form a DITA map.
This can be done by either the DITA Open Toolkit
dita -f html5 -i my.ditamap -o out/my.html -Droot-chunk-override=to-content
ditac -c single -f xhtml my.html my.ditamap
pdfreactor -s mystyles.css my.html my.pdf
prince -s mystyles.css my.html my.pdf
All DITA class and outputclass attributes are carried forward into the HTML markup. This will make it easy to write specific CSS styles that match related DITA elements, topics or whatever.
- no XSL-FO needed
- all styling and layout accomplished by CSS
- less complexity, no XSL-FO expert needed
- reduced costs (cheaper converters, no XSL-FO guru needed)
- similar quality as with FO
- taking advantage of modern CSS features like CSS transformations etc.
- Publishing with CSS Paged Media – A review of existing tools and techniques (Slides, XML Prague talk)
- Andreas Jung (firstname.lastname@example.org)