How-To GuidesMarch 16, 2026
Meidy Baffou·LazyPDF

How to Add Page Numbers to PDF on Linux

Adding page numbers to a PDF on Linux can be done several ways depending on your preference and what's already installed on your system. If you're looking for the fastest option with no setup required, a browser-based tool works identically on Linux as on any other platform — you open the browser, upload the PDF, and download a numbered version in under a minute. If you prefer working in the terminal, there are command-line tools that accomplish the same thing with more control over formatting. Linux users have more options than users on other platforms because the open-source ecosystem includes mature PDF manipulation tools. pdftk, qpdf, Ghostscript, and LaTeX's pdflpages package all offer PDF manipulation capabilities, though their approach to adding page numbers varies in complexity. This guide covers the practical options, starting with the easiest and working up to command-line approaches for users who need scripted or automated workflows.

The Quickest Method: Browser-Based on Any Linux Desktop

If you're using a Linux desktop environment (GNOME, KDE, XFCE, or any other), you have a web browser. Browser-based PDF tools work on Linux exactly as they do on Windows or macOS — no installation, no dependencies, no configuration. LazyPDF's page numbers tool runs on the server side, meaning it doesn't require any local software beyond your browser. You upload the PDF, configure the numbering style, and download the numbered document. This approach is ideal for occasional use and doesn't require any Linux-specific knowledge.

  1. 1Open your browser (Firefox, Chrome, or any browser on your Linux system)
  2. 2Navigate to lazy-pdf.com/page-numbers
  3. 3Click the upload area or drag your PDF into the tool
  4. 4Choose your page number format: position (bottom center, top right, etc.), starting number, and font size
  5. 5Click to add page numbers
  6. 6Download the numbered PDF to your Downloads folder

Using pdftk on the Command Line

pdftk (PDF Toolkit) is a widely used command-line tool on Linux for PDF manipulation. Installing it is straightforward on Debian/Ubuntu-based systems. Install pdftk: `sudo apt install pdftk` (Ubuntu/Debian) or `sudo dnf install pdftk` (Fedora/RHEL). While pdftk doesn't have a direct 'add page numbers' command, it can be combined with a stamp PDF (a PDF containing just the page number) to overlay numbers onto your document. This approach is more complex — you'd need to create a stamp PDF for each page, which is typically done with a script. For users who need automated workflows (numbering hundreds of PDFs in batch), a pdftk-based shell script is worth the setup time. For occasional use, the browser-based approach is more practical.

Using Ghostscript on Linux

Ghostscript is one of the most capable PDF tools available on Linux and is typically already installed on many distributions. It handles complex PDF operations including adding overlays and modifying page content. Adding page numbers with Ghostscript involves using a PostScript overlay that writes page number text on each page. The command is more complex than basic Ghostscript operations but is well-documented and scriptable. For advanced users comfortable with Ghostscript's PostScript model, this approach offers fine-grained control over number position, font, size, and format. For most users, the browser tool accomplishes the same result with considerably less effort.

  1. 1Verify Ghostscript is installed: run `gs --version` in terminal
  2. 2If not installed: `sudo apt install ghostscript` (Ubuntu/Debian)
  3. 3Create a PostScript number-overlay file (example available in Ghostscript documentation)
  4. 4Run the gs command with the overlay applied to each page
  5. 5Specify the output filename in the command
  6. 6Verify the output by opening the numbered PDF in a PDF viewer

Using LibreOffice Draw for Simple PDFs

If your PDF contains a small number of pages and was originally created from a document (rather than being a scanned image), LibreOffice Draw on Linux can open PDF files, add page numbers, and export back to PDF. Open LibreOffice Draw, use File > Open to open the PDF, and use Insert > Header and Footer to add page numbers across all pages. This approach works best for simple, text-based PDFs that LibreOffice can render accurately. Complex PDFs with intricate layouts may not import cleanly into LibreOffice Draw. For documents you originally created in LibreOffice Writer, add page numbers in Writer before exporting to PDF — this is cleaner and more reliable than post-export numbering.

Choosing the Right Method for Your Use Case

The right choice depends on your workflow and technical preference. For one-off page numbering tasks — adding numbers to a report, a form, or a document before sharing — the browser-based tool at LazyPDF is the most efficient approach regardless of your Linux proficiency. It takes under a minute and produces clean results. For batch processing — numbering 50 PDFs as part of a document workflow — a shell script using pdftk or Ghostscript is worth the setup time. Once the script exists, it can be rerun with different input files and will process consistently. For documents where you control the source — Word documents, Writer documents, InDesign files — always add page numbers in the source application before exporting to PDF. This produces the cleanest result and doesn't require any post-export manipulation.

Frequently Asked Questions

Does the browser-based page number tool work in Firefox on Linux?

Yes, LazyPDF works in any modern browser including Firefox, Chromium, Chrome, and other browsers available on Linux. The tool is entirely server-side — processing happens on the server, not in your browser — so browser compatibility is straightforward. Open the tool, upload your PDF, and download the result just as you would on any other operating system.

Is pdftk available on all Linux distributions?

pdftk is available in the package repositories of most major Linux distributions. On Ubuntu/Debian: sudo apt install pdftk. On Fedora/RHEL: sudo dnf install pdftk. On Arch Linux: sudo pacman -S pdftk. If pdftk is not in your distribution's default repositories, pdftk-java is a compatible alternative that's more widely maintained: sudo apt install pdftk-java.

Can I add page numbers to a scanned PDF (image-based) on Linux?

Yes — browser-based tools and Ghostscript-based methods can add page number overlays to image-based PDFs because they're overlaying new content on top of the existing page rather than modifying the existing text. The page numbers appear visually on each page in the same way as for text-based PDFs. The scanned content itself is unaffected.

How do I add page numbers starting from page 2 (skipping the cover page)?

LazyPDF's page numbers tool lets you configure the starting page and the first number to display. Set the starting page to 2 if you want to skip the cover page. You can also start the number count at 1 on page 2 (so page 2 shows '1') or at 2 (so page 2 shows '2'). The exact options are shown in the tool's interface when you upload your PDF.

Add professional page numbers to any PDF on Linux — no installation needed, works in any browser.

Add Page Numbers

Related Articles