1. Overview

There are many times when it’s necessary to modify the dimensions of a PDF file, such as resizing, cropping, or segmenting its pages. This may be necessary to meet specific printing requirements or to improve the layout of the document for further editing or merging into another PDF.

For example, a letter-size PDF might need to be adjusted for A4 printing, or a large diagram might need to be spread over several pages for a poster. Sometimes, the task is to reduce an A4 document to A5 or to crop a section of an A4 page without changing the overall size. The scenarios are as varied as they are common.

In this tutorial, we’ll see how to change the page size of a standard PDF. However, what we’ll see may not be effective on secured or encrypted PDFs. We’ll use the sample-1.pdf file to illustrate. Let’s save it as example.pdf.

In addition, we’ll see installation instructions using apt in Debian-based systems and dnf in Fedora-based systems.

2. How to Change the Print Size of a PDF

To adjust the print size of a PDF, we can use the built-in scaling and cropping features available in various PDF viewers. Usually, the default viewer included in our Linux distribution will be sufficient.

For example, let’s look at the Shrink to Printable Area and Fit to Printable Area options available in the Page Handling tab of Xreader, Linux Mint’s default viewer, and of Evince, Fedora’s default viewer:

Xreader - Shrink to Printable Area and Fit to Printable AreaAnother area worth exploring is the Page Setup tab. This section is particularly useful, as it allows us to select not only the print sheet size but also how many pages we want to print on each sheet. This cleverly resizes the pages to fit the available space:

Xreader - Page SetupThese print options are often enough to satisfy our resizing needs without modifying the PDF document.

3. GUI Tools to Convert PDF Size

Graphical User Interface (GUI) tools can provide an intuitive way to manage page sizes because they offer a visual approach.

Before we go any further, let’s check the size of our sample PDF:

Example PDF page sizeSo, our goal is to convert this PDF to a size other than US Letter.

3.1. Any PDF Viewer + Print to File Option

Both GTK+ and QT include the ability to simulate the printing process, so applications built with these frameworks can provide the Print to File option to redirect output to a PDF file instead of sending the data to an actual printer. This option can make it easy to convert a PDF to a different page size.

First, let’s open our PDF document, then go to the print dialog and select the Print to File virtual printer. We need to select the PDF format and choose the output file:

Print to File PDF virtual printerIn the Page Setup tab, let’s set the paper size to A2, and in the Page Handling tab, let’s select Fit to Printable Area:

example printing options to convert a PDF to a different page sizeAfter printing, the resulting PDF file has the desired new page dimensions:

PDF converted from US Letter to A2So, we converted this PDF from US Letter to A2. However, this method may not preserve all elements of the PDF, such as hyperlinks and bookmarks, which could be a significant drawback if such features are required.

As a side note, in the unlikely event that Print to File isn’t available, we can still install CUPS-PDF from the Debian and Fedora package managers:

$ sudo apt install printer-driver-cups-pdf # Debian-based distros
$ sudo dnf install cups-pdf                # Fedora-based distros

This way, we’ll have a virtual printer that prints to PDF files.

3.2. PDF Arranger

PDF Arranger is a handy tool for managing PDF documents. It allows us to easily merge, split, rotate, crop, and resize PDF pages within a user-friendly interface. Let’s install it:

$ sudo apt install pdfarranger # Debian-based distros
$ sudo dnf install pdfarranger # Fedora-based distros

To resize pages with PDF Arranger, let’s select the pages we want to resize and open the Page Format dialog. The next steps are intuitive:

In this example, we again converted the PDF from US Letter to A2. Unfortunately, as in the previous case, hyperlinks, bookmarks, and other metadata are lost.

3.3. GIMP

If we need fine control over the content and size of each page, GIMP, which is primarily an image editor, is a good option. Let’s install it:

$ sudo apt install gimp # Debian-based distros
$ sudo dnf install gimp # Fedora-based distros

When we open a PDF in GIMP, we can import one or more pages at the DPI resolution we want. When multiple pages are selected, each page is imported as a separate layer, which we can edit independently. To resize, we can adjust the canvas size or scale the layers to the desired dimensions. After editing, we can export the layers as new PDF pages or as a single, multi-page PDF document.

Let’s see the complete process with GIMP to convert our example PDF from US Letter to A2. In the Import window, we’ll set the resolution to 300 DPI, which is usually the minimum to get an acceptable quality:

Although GIMP offers powerful editing capabilities, it’s not the right tool for simple resizing-only tasks because the resulting PDF may be considerably larger than the source PDF. In the example shown in the video, the source PDF is 68.3 KiB, while the resized PDF is 3.3 MiB, which is 50 times heavier.

This happens because GIMP converts each page into a raster image based on the resolution we specify in the Import window. Also, as in the previous cases, links and metadata associated with the PDF are lost.

4. CLI Tools to Convert PDF Size

We’ll see two CLI tools that provide a quick and effective way to resize PDF pages. Before we go any further, let’s see how to check the page size of a PDF from the terminal. The command is a bit complex because it does the conversion from pt to mm, and it requires the pdfinfo utility provided by the poppler-utils package:

$ sudo apt install poppler-utils # Debian-based distros
$ sudo dnf install poppler-utils # Fedora-based distros

To simplify, let’s create the Bash function pdfsize(), which we’ll use in the upcoming examples. Let’s copy and paste it into the terminal:

pdfsize() {
    pdfinfo "$1" | grep 'Page size' | awk '{printf "Page size: %.2f x %.2f mm\n", $3*25.4/72, $5*25.4/72}'
}

Then let’s check our example file:

$ pdfsize example.pdf 
Page size: 215.90 x 279.40 mm

We’ll see how to convert these US Letter dimensions to A2.

4.1. pdfjam

pdfjam is part of the TeX Live distribution. However, it’s packaged differently on Debian and Fedora-based distributions:

$ sudo apt install texlive-extra-utils # Debian-based distros
$ sudo dnf install texlive-pdfjam      # Fedora-based distros

Among other features, it can be used to adjust PDF page sizes with an intuitive syntax:

$ pdfjam --outfile example-A2-pdfjam.pdf --paper a2paper example.pdf
$ pdfsize example-A2-pdfjam.pdf 
Page size: 420.00 x 594.00 mm

The result is as expected. The –paper option must be followed by a valid LaTeX paper size. However, we can use custom sizes with this different syntax:

$ pdfjam --outfile example-custom-size.pdf --papersize '{200mm,350mm}' example.pdf
$ pdfsize example-custom-size.pdf 
Page size: 200.00 x 350.00 mm

Unfortunately, again, hyperlinks and bookmarks are lost.

4.2. pdfposter

The primary use of pdfposter, as the name suggests, is to create posters by printing multiple pages of a PDF. However, we can also use it to resize a PDF with a very simple syntax. First, let’s install it:

$ sudo apt install pdfposter   # Debian-based distros
$ sudo dnf install pdfposter   # Fedora-based distros

Then, let’s do a US Letter to A2 conversion:

$ pdfposter -mA2 example.pdf example-A2-pdfposter.pdf
$ pdfsize example-A2-pdfposter.pdf 
Page size: 420.16 x 594.08 mm

We can also specify custom sizes, e.g., 200x350mm:

$ pdfposter -m200x350mm example.pdf example-custom-pdfposter.pdf
$ pdfsize example-custom-pdfposter.pdf 
Page size: 200.00 x 350.00 mm

Again, links and bookmarks are lost.

5. Conclusion

In this article, we’ve seen how to resize the pages of a PDF file using both graphical and command-line tools:

  • scaling and cropping features of PDF viewers
  • any PDF viewer + Print to File option
  • PDF Arranger
  • GIMP
  • pdfjam
  • pdfposter

With the exception of GIMP, which is intended for special cases, all other methods are equivalent for basic use. However, all of them have the disadvantage of removing links, bookmarks, and other metadata. The choice of tool depends on subjective preference or, in the case of command-line tools, ease of integration into scripts.

Comments are closed on this article!