3.3.3 Creating output file metadata

In addition to being shown in the printed output, \header variables are also used to set metadata for output files. For example, with PDF files, this metadata could be displayed by PDF readers as the properties of the PDF file. For each type of output file, only the \header definitions of blocks that define separate files of that type, and blocks higher in the block hierarchy, will be consulted. Therefore, for PDF files, only the \book level and the top level \header definitions affect the document-wide PDF metadata, whereas for MIDI files, all headers above or at the \score level are used.

For example, setting the title property of the header block to ‘Symphony I’ will also give this title to the PDF document, and use it as the sequence name of the MIDI file.

\header {
  title = "Symphony I"
}

If you want to set the title of the printed output to one value, but have the title property of the PDF to have a different value, you can use pdftitle, as below.

\header {
  title = "Symphony I"
  pdftitle = "Symphony I by Beethoven"
}

The variables title, subject, keywords, subtitle, composer, arranger, poet, author and copyright all set PDF properties and can all be prefixed with ‘pdf’ to set a PDF property to a value different from the printed output.

The PDF property Creator is automatically set to ‘LilyPond’ plus the current LilyPond version, and CreationDate and ModDate are both set to the current date and time. ModDate can be overridden by setting the header variable moddate (or pdfmoddate) to a valid PDF date string.

The title variable sets also the sequence name for MIDI. The midititle variable can be used to set the sequence name independently of the value used for typeset output.


LilyPond — Notation Reference v2.23.82 (development-branch).