Source Code as PDF

March 12, 2026 ยท View on GitHub

For documentation purposes Venice source code can be rendered to HTML or PDF documents. The rendering process is started from a REPL.

Example

Open a REPL and use the command !source-pdf:

To create a HTML and PDF representation from the 'sudoku.venice' script run:

venice> !source-pdf ./scripts/sudoku.venice

Note: The 'sudoku.venice' script is installed at REPL setup time in the REPL 'scripts' directory.

Sudoku Solver Source Code

Output Examples:

Sudoku PDF
Sudoku HTML

Prerequisites

The Venice PDF renderer is based on the Flying Saucer project and requires these Java libraries:

  • org.xhtmlrenderer:flying-saucer-core:9.1.22
  • org.xhtmlrenderer:flying-saucer-pdf-openpdf:9.1.22
  • com.github.librepdf:openpdf:1.3.30
  • com.github.librepdf:pdf-toolbox:1.3.30

and the fonts:

  • OpenSans-Regular.ttf
  • JetBrainsMono-Regular.ttf

Run this script from the REPL to download the fonts and PDF libraries:

(do
  (load-module :pdf-install)
  (load-module :fonts)
  
  ;; Download the PDF libs from Maven and the fonts
  (pdf-install/install :dir (repl/libs-dir) :silent false)

  ;; Restart the REPL to make the new libs available to the REPL Java VM
  (println "\nRestarting REPL...")
  (repl/restart))