PDF files: read and edit PDFs on a Raspberry Pi

By Russell Barnes. Posted

PDF documents have all kinds of uses, from receipts and invoices from online shops, to newsletters and magazines – including The MagPi.

Whether you’re reading this article in print or as an electronic document, the pages you are reading began as PDF files, which are either sent to a printer or uploaded to the web.

There’s a reason for this. PDFs are excellent at preserving complex layouts of text and graphics, meaning that the recipient sees exactly what you intended them to see, regardless of the device and software used.

As well as guaranteeing quality and consistency when distributing documents, the PDF is an excellent tool for archiving documents and information. Rather than printing a receipt from a website or a document you’ve created, save it as a PDF (often called ‘printing to file’). This lets you keep a record that doesn’t take up any space, and which you can find easily without rifling through a filing cabinet or a stack of paper.

While we often think of PDF as a read-only file type – something that we can only look at – modern PDF software allows us to edit almost any PDF. For example, if a school emails a PDF letter asking for contact details, you can type those details into the PDF, save it, and email the completed form back. No more printing forms and hoping your child remembers to hand them to the teacher.

The good news is that you can complete all these tasks using a Raspberry Pi. This includes using the PDF viewer built into Raspbian to open, save, and print documents – but we’ll also show you how to install a more advanced PDF viewer to edit your PDF files.

>STEP-01: Saving PDF files

Whether you’re viewing a PDF from an email, a download, or a USB drive, save it to your Pi as you would any other file. To read The MagPi on your Raspberry Pi click here to download The MagPi issue 63. By default, the PDF file will open inside the Chromium web browser. Right-click and choose Save As and Save.

>STEP-02: Opening a PDF file

Double-click on the PDF file (located in the Downloads folder) and you will be asked which application you would like to use to open it. Open Accessories and choose PDF Viewer, and tick the Set selected application as default action for this file type box at the bottom to set PDF Viewer as your default PDF program. Click OK.

>STEP-03: Adjusting the view

To resize your PDF to fit the window, open the zoom menu (click the downwards arrow next to the size box at the bottom of the window). Choose a size, or use ‘fit width’ if you want the PDF page to be the same width as the window.

>STEP-04: Searching a PDF

You can search a PDF for specific words by clicking the binoculars button at the bottom of the window. Use ‘Match case’ or ‘Whole words only’ to narrow your search.

>STEP-05: Printing a PDF

To print your PDF, click the printer button at the bottom of the window. You can print the whole document, or a range using the Pages boxes.

>STEP-06: Installing Okular

If you want to edit a PDF, you’ll need to install Okular. Go to Menu > Preferences > Add/Remove Programs. Search for Okular, tick the box, and click OK. To open a PDF in Okular, right-click on the file and select Okular.

>STEP-07: Editing a PDF

Open the Tools menu in Okular and click Review to show the editing tools sidebar. To highlight or underline text, select the text with the cursor (as in a word processor), and click the relevant tool button. You can also add notes and shapes to the document.

From The MagPi store