How to remove pages from a PDF from your Linux PC

How to remove pages from a pdf

In my opinion, saving the documents in PDF is the best option. A PDF does not take up much space and it is also capable of saving a file with the highest quality, a quality that is maintained even when we enlarge the images. But sometimes a PDF has not been created by us or we have created it, for example, from a web page. What do we do with the information we have left over? Remove pages from a PDF Is the best option.

Removing pages from a PDF is very easy. The problem is that many of us have the preconceived idea that a PDF file cannot be edited; by extension, if it cannot be edited, pages cannot be removed. But this is an idea that we have internalized because this was the case a long time ago. Nowadays, PDFs can be edited and, so far this article is about, deleting pages of information that we do not want to keep.

How to remove pages from a PDF with LibreOffice Draw

LibreOffice Draw It is a very powerful program that surprises both for the possibilities it offers and for its ease of use. Removing pages from a PDF with LibreOffice Draw is so simple that it's hard to figure out how to do it. I explain it to you below:

  1. To remove pages from a PDF with LibreOffice Draw we must first open the document with this program. We can do it either from the "File / Open" menu or by right clicking on the document and choosing LibreOffice Draw as the application to open it.
  2. Once inside you will see something like the following:

LibreOffice Draw

  1. The next step is to mark the page that we want to delete, more specifically its thumbnail in the left panel.
  2. If we keep the wrong idea that a PDF cannot be deleted, we will never think how easy it is to do it: the "miracle" will happen with just pressing the "Delete" key. You will see that the page disappears.
  3. Finally, we go to «File / Export to PDF» to save the new document without extra pages. Make no mistake choosing "Save" because LibreOffice it has its own formats and by default it saves it in its own way. You have to "Export".

What did you not imagine that it would be so easy?

LibreOffice PDF Options
Related article:
LibreOffice: Create Fillable or Editable PDF

With pdftk

As in Linux we have so many options and one of them likes some more than others, we can also do it from the terminal. This requires the pdftk (PDF Tookit) tool. It actually costs more than doing it with LibreOffice Draw, but we will also provide you with information to do something that is easier with pdftk: separate a PDF by pages. To remove pages from a PDF with this tool we will have to do the following:

  1. We install the tool with the command sudo snap install pdftk o sudo apt install pdf-java.
  2. I have a PDF that I have created from Firefox called mozilla.pdf. It has 5 pages and I am going to take away the third one. To do this I will open a terminal and write:
pdftk mozilla.pdf cat 1-2 4-end output documento.pdf

From the above we have:

  • mozilla.pdf is the document I want to edit.
  • cat is the order.
  • 1-2 y 4-end they are the pages that it will keep or, what is the same, it will eliminate the third because it will keep 1, 2 and 4 until the end (end).
  • output tells you that the next will be the new document.
  • documento.pdf is the document you will create without page 3.
  • Remember that in this and other commands, when the files are being mentioned, it is understood that the full path goes before, such as /home/pablinux/Desktop/mozilla.pdf.
  • If after pressing Enter it does not show anything, it is assumed that it is because everything has gone well. We will only see errors if we have forgotten part of the command or if something has failed.

And separate a PDF by single pages?

As we mentioned earlier, pdftk it also allows us separate the whole PDF by pages one by one. Right now I can't think of any reason why this would be useful, but I'm commenting on it as information in case it works for anyone. The command would be the following, taking into account that "mozilla.pdf" is the document that I want to divide by pages:

pdftk mozilla.pdf burst

As with the previous command, if everything went well it will not display a message after pressing Enter. The only important thing here is to know what it does with the file once it is split: save it in our personal folder (with names pg_0001, pg_0002, pg_003, etc, where "pg" matches the page number) and creates a file with metadata called doc_data.txt in the same path. Among the information stored in this .txt we have the number of pages that were in the original, if we had used a marker, the date of creation and even the program with which it was created and the version of it.

Personally and as I always say, I usually choose the options that allow me to perform all my tasks from one user interface or GUI. But sometimes, using a command line, especially if we are quick to write or create a .dekstop / script, may be a better option, and as an example it is worth separating the pages of a PDF with pdftk. What do you prefer: do it with LibreOffice or a similar program or with tools that are used from the Terminal such as pdftk?

poppler_logo
Related article:
Poppler an excellent command line tool for PDF

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.