[publican-list] Code syntax highlighting in PDF

Jeff Fearn jfearn at redhat.com
Tue Oct 6 02:43:09 UTC 2015


On 09/18/2015 04:47 PM, Alan Murrell wrote:
> Hello,
> 
> I am running Publican 4.3.2 on Fedora 22 (Publican packages just got
> updated so they properly build the documents. Yay!)
> 
> I was playing around with including code samples and the syntax
> highlighting works with HTML formats but there is no such highlighting
> in the PDF format.
> 
> What would I need to add to the PDF XSL file to make this so?

Two options:

1: Install upstream wkhtmltopdf and it will just work.

2: For FOP you need to add back in all the PDF customization we removed.
This will only work for a limited period as they rely on customization
in Publican to work and they will be removed in 5.0.

You need to add the xmlns:perl name space, switch on highlight

<xsl:param name="highlight.source" select="1"/>

And then add any of the templates related to highlighting from

https://git.fedorahosted.org/cgit/publican.git/tree/datadir/xsl/pdf.xsl?id=Release-4.2.6

Cheers, Jeff.

-- 
Jeff Fearn
Senior Software Engineer
PnT - DevOps - Development
Red Hat Asia Pacific Pty Ltd
http://dilbert.com/fast/2004-08-17/




More information about the publican-list mailing list