SysTutorials

PDF Margin Cropping Tool for Linux

If you need to remove excess white space or trim margins from PDF files, several graphical tools can handle this on Linux. Here are the most practical options.

Krop

Krop is a straightforward tool specifically designed for PDF cropping. It lets you define crop regions visually and apply them to single pages or entire documents.

Installation:

On Fedora/RHEL:

sudo dnf install krop

On Debian/Ubuntu:

sudo apt install krop

On Arch:

sudo pacman -S krop

Usage:

Launch it with krop and open your PDF. You can draw crop regions directly on the pages and preview changes before applying them. It’s minimal but effective for straightforward cropping tasks.

Pdfcrop (Command-Line Alternative)

If you prefer command-line tools with optional GUI frontends, pdfcrop is lightweight and powerful:

# Install on Debian/Ubuntu
sudo apt install texlive-extra-utils

# Install on Fedora
sudo dnf install texlive-pdftools

Basic usage:

pdfcrop input.pdf output.pdf

Crop specific margins (in bp, where 1bp = 1/72 inch):

pdfcrop --margins "10 20 10 20" input.pdf output.pdf

Margins format: left top right bottom.

Pdfsizeopt (GUI via Python)

For more advanced control over PDF optimization and cropping:

pip install pdfsizeopt

Poppler Utilities

The pdfseparate and pdfunite tools from Poppler can help manipulate PDFs:

# Debian/Ubuntu
sudo apt install poppler-utils

# Fedora
sudo dnf install poppler-utils

Extract a range of pages:

pdfseparate -f 5 -l 10 input.pdf output-%d.pdf

GUI-Based Option: LibreOffice Draw

If you have LibreOffice installed, you can open PDFs in Draw, manually adjust crop areas, and export:

libreoffice --draw document.pdf

This works but isn’t as streamlined as dedicated tools.

Batch Processing with ImageMagick

For automated margin removal across multiple PDFs, convert to images, crop, then reconstruct:

# Install ImageMagick
sudo apt install imagemagick ghostscript

# Convert, trim, and recreate PDF
convert -density 150 input.pdf -trim +repage output.pdf

The -trim option removes uniform borders automatically. The +repage resets virtual canvas boundaries.

Choosing the Right Tool

Most Linux distributions favor command-line tools for reliability and scriptability, but Krop remains the best choice if you want a dedicated GUI experience without terminal overhead.

Troubleshooting Common Issues

When encountering problems on Linux systems, follow a systematic approach. Check system logs first using journalctl for systemd-based distributions. Verify service status with systemctl before attempting restarts. For network issues, use ip addr and ss -tulpn to diagnose connectivity problems.

Package management issues often stem from stale caches. Run dnf clean all on Fedora or apt clean on Ubuntu before retrying failed installations. If a package has unmet dependencies, try resolving them with dnf autoremove or apt autoremove.

These commands are frequently used alongside the tools discussed in this article:

Quick Verification

After applying the changes described above, verify that everything works as expected. Run the relevant commands to confirm the new configuration is active. Check system logs for any errors or warnings that might indicate problems. If something does not work as expected, review the steps carefully and consult the official documentation for your specific version.

← All posts