Skip to content

Latest commit

 

History

History
60 lines (36 loc) · 1.62 KB

source2pdf.md

File metadata and controls

60 lines (36 loc) · 1.62 KB

Source Code as PDF

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

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))