Skip to content

File formats

Klaus Blum edited this page Apr 3, 2022 · 17 revisions

File formats

ANNOUNCEMENT
OOoLilyPond has moved to a new repository:
https://github.com/OOoLilyPond
All past/present/future development can be found at the new location. The page you are viewing right here contains all development up to V. 1.0.1, but it will no longer be maintained.

The Format dropdown box on the Config dialogue lets you choose which graphic file format OLy will use to insert musical snippets into your document.
Each format has its specific advantages and disadvantages.

If you don't mind installing a small piece of additional software, I would recommend to choose the PDF to SVG format.

Currently, OLy supports the following formats:

PDF to SVG (recommended)

+ good image quality (vector format)
+ no dedicated templates and no additional fonts required
- requires third-party conversion software
+ supports inserting as separate images (system-by-system)

SVG [-dcrop]

+ good image quality (vector format)
- requires dedicated templates
- requires installing additional fonts
- does not support inserting as separate images (system-by-system)
only usable in LibreOffice (not in OpenOffice)
requires LilyPond v. 2.19 (or newer)

SVG

+ good image quality (vector format)
- requires dedicated templates
- requires installing additional fonts
- no automatic cropping (must be done manually)
- does not support inserting as separate images (system-by-system)
only usable in LibreOffice (not in OpenOffice)

PNG

- limited image quality (bitmap format)
+ works immediately, no further preparations required
- does not support inserting as separate images (system-by-system)
+ usable in both LibreOffice and OpenOffice

EPS

+ good image quality (vector format)
- only usable in OpenOffice (not in LibreOffice)
+ supports inserting as separate images (system-by-system)
- images are not displayed on screen and in PDF export (only in printout).

PDF to SVG

With this option selected, OLy will call LilyPond to produce a PDF file. Unlike with the SVG option, this works with any template, no restrictions apply. Also, no additional fonts have to be installed.
Therefore, this is the file format I'd currently recommend to choose.

However, as a second step, this PDF file has to be converted into an SVG file which then will be inserted into your LO document. That means, you will have to install an additional conversion software.
In OLy's Config dialogue, you need to specify the exact command line to be called.

For Linux and Mac, this is easy: You can install the "pdf2svg" package via your package manager.
In the terminal, you should be able to install it with
sudo apt-get install pdf2svg.

The default settings for the command line to be called should already be visible in the Config dialogue:

As command in the first edit field you simply need pdf2svg. The checkbox for "*.svg*" needs to be activated. Leave the second edit field empty.

That's all. The resulting command line will look similar to this (replace "klaus" with your actual user name):
pdf2svg "/home/klaus/.cache/ooolilypond/tmp/OOoLilyPond.pdf" "/home/klaus/.cache/ooolilypond/tmp/OOoLilyPond.svg"

Between the contents of the two edit fields, OLy inserts the filename OOoLilyPond.pdf preceeded by the correct path, wrapped in quotation marks - and (if the checkbox is activated) the same with OOoLilyPond.svg.

For Windows, a suitable third-party tool has to be installed at your own risk. At the moment, the only one I know of can be found here*1:

http://blog.alivate.com.au/poppler-windows/
Direct download: http://blog.alivate.com.au/wp-content/uploads/2018/10/poppler-0.68.0_x86.7z

There is no installation, you just unpack its contents to a location of your choice (for example C:\Portable\).

Back to the Config dialogue: In the first edit field, specify the complete path to the executable file, wrapped in quotation marks, add a whitespace and the parameter -svg (for example
"C:\Portable\poppler-0.68.0\bin\pdftocairo.exe" -svg.
The checkbox should not be activated, the second edit field must be empty.

As above, OLy inserts the PDF file name including its path.
In my case ("Klaus" is my user name) the resulting command line is:
"C:\Portable\poppler-0.68.0\bin\pdftocairo.exe" -svg "C:\Users\Klaus\AppData\Local\Temp\OOoLilyPond.pdf"

That's it.

SVG and SVG [-dcrop]

There are two different ways to use the SVG file format. It is only supported by LibreOffice (and not by OpenOffice. The latter cannot import SVG files produced by LilyPond).

  • SVG format requires templates marked [SVG] in their name, SVG [-dcrop] format requires templates marked [SVG -dcrop].
  • probably you have to install some fonts, for detailed instructions see SVG formats: Providing fonts

The "SVG [-dcrop]" format might be the recommended option for you if you don't want to install additional conversion software (which would be necessary for using "PDF to SVG", see below.)
Attention, this requires LilyPond V. 2.19 or newer. Older LilyPond versions up to 2.18 didn't yet know the -dcrop parameter.

The "SVG" format is the only one that has no automatic cropping, so it requires you to do that manually. See SVG: Manual cropping.

"[SVG]" templates that date from an OLy version starting with 0.5 need some additional modification. If you haven't already done that in the past, here is a step-by-step guide: SVG - Adapting older templates.

PNG

This file format is used by default, because it works equally in LibreOffice and OpenOffice, on Windows, Linux or Mac. No additional steps have to be taken before using it.

The Resolution for PNG images can be specified. The default value (300) should be usable. Increasing this value will raise image quality, but also the file size.

However, PNG is not the best choice with regard to image quality: File formats - bitmap vs. vector.

Furthermore, PNG does not support the "insert as separate images (system-by-system)" option.

EPS

EPS is a vector format. However, there are several reasons why I would not recommend it for daily use:

At the moment, EPS is only usable in OpenOffice. LibreOffice cannot handle it.

EPS images are printed correctly, but OpenOffice does not display them on screen. It's helpful to use PNG format at first. Once the musical snippets look as indended, they can be recompiled using the EPS format.

EPS images also are missing in PDF export.
At least on Windows, there is a workaround for that: Printing the document with a "print to pdf" driver leads to correct results. Those printer drivers create a PDF file instead of printing on paper. Windows 10 has a built-in printer driver named "Microsoft Print to PDF" that works well here.


*1) While I don't know if I should recommend a software I barely know, all I can say is, I've been using it for several months now and to me it performs allright.

Apparently it consists of the same two libraries (poppler and cairo) as pdf2svg, ported to windows.

There is no license information for this software, but as the poppler library is licensed under GPL v2 or v3, the same ought to apply as well for any software that is using it.

In other words: There should be no restrictions to download and use it for OLy.

If you know any other tools for that conversion task, I'd be happy to mention them here. (Inkscape cannot [yet?] be used for this.) (back)