Forum Samples, Tips and Tricks

A quick guide to musical notation in Prince

howcome
I've written an experimental guide to adding musical notation in HTML and convert it to PDF with Prince.

https://css4.pub/2024/music

Prince does not support musical notation natively, but will happily read SVG files with musical scores. In this quick guide, you will learn how to embed the Lilypond musical notation in HTML files and generate the necessary SVG files behind the scene.

This tutorial requires some knowledge of Linux, but the two-pass approach will work on any platform. In the first run, Prince looks for HTML elements with lilypond code inside, and prints out a series of commands which extracts these code snippets into separate files, convert them into SVG, and runs Prince again to create the final PDF file. Bach would be proud to see his music engraved by such fine software.



Edited by howcome