PDF Types in LibreOffice

Custom Export

By

With LibreOffice, you can customize the way you export PDFs.

LibreOffice and related apps have supported the PDF format for over a decade. If nothing else, LibreOffice is a free alternative to the $15 monthly fee required to license Adobe’s Acrobat tools.

Most people exporting a PDF from LibreOffice just use the default settings, exporting to PDF as quickly as possible. However, those who are more hands-on know that they can do more than accept the default. If users choose, they can customize everything from the pages to export to the look of the exported file in a reader and its initial view from File | Export as | Export as PDF…. By clicking on the General tab, you can see that those options include four PDF format variants: Hybrid, Archive, and Tagged, and PDF forms (Figure 1). Each of these PDF types requires different preparation.

Figure 1: The four PDFs that LibreOffice supports.

Hybrid PDFs

Hybrid PDFs are two files in one: a PDF file and an Open Document Format (ODF) file, which is the default format for LibreOffice. A Hybrid PDF acts like a normal PDF file in a reader, but it can open in the appropriate LibreOffice module -- Writer, Calc, or Impress.

Why would you want a Hybrid PDF? The reason is simple. LibreOffice has supported editing of PDF files in Draw for years. Draw is a useful PDF viewer, because it supports multiple pages and includes a pane for jumping from one page to another, just like a dedicated PDF reader.

However, how much you can edit is limited. Images can be edited freely, but text in a PDF is structured line by line (Figure 2). You can change words within a line. If there is enough white space, you can even add a line. However, any changes longer than a line require editing the line below as well. In no time at all, you can have cascading changes and endless lines to edit. More substantial edits, such as adding or deleting a paragraph -- let alone a page -- can be almost impossible.

Figure 2: LibreOffice supports editing PDFs in Draw, but the PDF's structure means that editing is line by line.

By contrast, the ODF file in a Hybrid opens in the appropriate LibreOffice module and can be edited as easily as the original file. When you are finished, the changes are passed on to the Hybrid PDF as you save. What might take an hour to edit in an ordinary PDF can be reduced to a couple of minutes in a Hybrid.

As a side benefit, you can store both formats in the same document, reducing the number of files you need to track.

One drawback to a Hybrid PDF is that it is two files in one, and therefore about 50 percent larger than an ordinary PDF file. Another drawback is that there is no way to identify a Hybrid in a file manager. You can only open the Hybrid in LibreOffice and check in which LibreOffice module it opens. Yet even that may not help, because Tagged, ordinary PDFs, and Hybrids created in Draw will all open in Draw. The easiest way to identify Hybrids is to save them to a directory called Hybrid PDFs.

Archive PDF

Changing formats -- especially proprietary ones -- means that the software needed to read and edit documents written today may not be available at some point in the future. Open source formats are generally considered the best hedge against this possibility, but Adobe has released an open standards solution in the form of PDF/A (ISO19005-1). In the short term, the format is useful for ensuring that a PDF can be read on any system, regardless of its resources.

A PDF/A file is a PDF that contains everything necessary to display the file, embedding fonts, images, and anything else that the document requires. In addition, when creating an archive file you might want to fill out the fields in Tools | Options | Personal Data, as well as the metadata fields in Files | Properties. In particular, the Description and Custom Properties tabs can be used. Include any information that you think someone else using the file might need to know.

Note that Archived PDF files can be huge, especially if a document contains several different fonts. To give you an idea, an Archived PDF file with no images using a single font is almost half as big again as the same document in an ordinary PDF.

Tagged PDF

When you open File | Export As | Export as PDF, you'll find Tagged PDF (add document structure) already selected. The reason for this default is that Tagged PDFs have several advantages over ordinary PDFs while adding little to the file size. In fact, online, you often find suggestions that everyone should be using Tagged PDFs.

A Tagged PDF contains meta-information about the structure and layout of the document, adding far more details than are contained in an ordinary PDF, which is formatted by the position of lines on a page. This information is unseen in PDF readers, but has a number of advantages.

To start with, a Tagged PDF opens quicker. For another, when all or part of a file is copied to another application, it displays as a single graphic file and does not need to be reformatted, which makes recovery of information easier, as well as making reading easier for other applications, such as accessibility tools, to import and manipulate the file. Other tags can also be added, such as geographic information. In general, a Tagged PDF makes the PDF format easier to work with, although it opens in Draw in LibreOffice.

PDF Forms

PDF forms can be filled in by users and emailed from a web page with a simple script (examples of which can be found online for different programming languages, such as JavaScript or Python). To make a form, open a new Writer file and select View | Toolbars | Form Controls. If you are doing a long, complicated form, you might also select the Form Design toolbar, which contains such useful tools as the Form Navigator, as well as buttons for toggling the design grid. Otherwise, you can get by with just the Form Controls toolbar.

To begin designing a form, toggle on Design Mode in the Form Design toolbar. You can add all the usual widgets to the form, defining their size and position with the mouse. Available widgets include input fields, option buttons, checkboxes, and combo boxes. Each widget can be further defined by clicking on it and making selections from the Properties Checkbox dialog (Figure 3).

Figure 3: The tools for creating a PDF form.

When you are finished, save the form and select File | Export As | Export as PDF… | General | Create PDF form. You will also need to make a choice from the Submit format combo box to choose the format in which completed forms will be sent: FDF, PDF, HTML, or XML. You can check the results by opening the resulting PDF and trying to write in a field or use a widget.

Choices

To some extent, these options can be combined. You can combine a Hybrid and Archive PDF without difficulty or use either with a PDF form. However, there would be no point in using a PDF form or an Archive with a Tagged PDF, because their purposes are more or less opposing ones.

And what if you choose File | Export As | Export As PDF, simply accepting LibreOffice’s default settings? Then your only concern is to name the file you produce. I have not found a complete list of PDF export defaults, but presumably the settings are those that are active when you open the PDF Options dialog, including JPEG Compression set at 90%, Tagged PDF, and Export bookmarks. These defaults work extremely well for many purposes, but it can be useful to remember that they are not the only options when you create PDFs with LibreOffice.

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News