On 16.09.22 14:44, Andreas Reichel wrote:
Greetings and compliments of the day.

We use FOP successfully to generate nice PDF files for our technical documentation. Although there is one more requirement: printing formatted code blocks with syntax highlighting (e. g. SQL or Java code snippets). What would be the best way to achieve that?

I have tried to convert the SQL/Java code to SVG via Pygments and to insert it as EXTERNAL_GRAPHICS. This works in general, but I cant control the sizing. Each EXTERNAL_GRAPHICS will have a different size of characters based on the size of the graphics.

Does anyone know a better way or has done something similar already? I would appreciate any idea or hint.
Thank you in advance and best regards


Hi Andreas,

I haven't had such a problem yet, so I don't know tools that perform the actual syntax highlighting. But what I do not understand is why you are using SVG and external graphics. FO is capable of doing preformatted text and also of colorizing text. So no need to go that path. Since you using scripts anyway (as far as I understand), it shouldn't be too complicated to generated XML fragments to be inserted into you document.



To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to