Ah, the PDF. Portable Document Format. For the last decade, the PDF has been a critical element in business. Granted, over the last few years the prevalence of the PDF has been reduced, thanks to mobile apps and other digital tools. Nevertheless, the PDF still holds powerful sway over business. Why? It’s easy to use, easy to create, and can be viewed on nearly every type of device.
One of the more important, business-centric elements of the PDF is the ability to create interactive documents. With these files, users can answer questions, fill in missing information, and so much more.
Most assume you have to work with a tool specifically designed to create interactive PDFs (such as Scribus). Or worse, that you would have to use a command line tool like LyX. You’d be surprised to find out that neither are required. In fact, thanks to LibreOffice, interactive PDFs are incredibly easy to create.
Let’s walk through the process of creating an interactive PDF with LibreOffice 5. For reference, I’ll be using LibreOffice 22.214.171.124 on Elementary OS Loki. These same steps will work on any platform.
What you can add to PDFs
It should come as no surprise that you can add numerous interactive elements to a LibreOffice document. If you click on Insert | Form Control, you will see the entire list of elements (Figure A).
I’m going to walk you through the process of adding a couple of these elements and then exporting the document so it can be distributed to your users.
Adding an element
Let’s add the elements to a simple document. You will first want to have your document designed and the necessary images and text entered, prior to adding the interactive elements. Let’s first add a text box. Say you need users to enter their name. Click Insert | Form Control and the cursor will change so that you can draw the box (Figure B). If the text box doesn’t wind up where you need it, fear not, you can drag and resize it accordingly.
Once you have the text box in place, you’re ready to move on to the next element. Let’s say you want a group of checkboxes so the user can select an option. Each checkbox will also contain a label, so you don’t have to worry about first creating the text for each. Click Insert | Form Control and the select Check Box. Once the cursor changes, click on the document and drag it to draw the element. Double click on the newly drawn check box to bring up the Properties window and fill out the options as needed (Figure C).
Once you’ve customized the check box, click the X in the upper left corner to close out the Properties window. Continue to add check boxes until you’re satisfied. With all of your check boxes completed, drag/resize them until they are exactly where you need them (Figure D).
You will also notice, in Insert | Form Control, a number of elements (such as List Box, Combo Box, and Group Box) that require the addition of a data source. This data must come from a LibreOffice created database. I’ll deal with the creation of such data in a later post.
Exporting your document
When you’ve added the necessary elements to your document, click File | Export as PDF, accept the defaults, click Export, give the document a name, select a location to save the document, and click Save.
Once the document has saved, you have created your first interactive PDF with LibreOffice. When a user opens the PDF, they can enter their data and will be prompted to save before closing. They can then return the document to you…data intact.
Interactive PDFs made easy
Congratulations, you’ve created your first interactive PDF with LibreOffice. Until you get involved with combo/list/group boxes, the process is incredibly easy and should not prevent anyone from creating much-needed interactive documents.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays