How to add pagenumber to pdf?

I have a pdf consisting of 250ish pages that I need to print on paper. Problem is that I need the pages to be numbered, which they are not in the pdf file. How can I add page numbers before print?
(I would also prefer to add a document title as a header/footer. But page number is the most important)

usually you add those things before you convert your document into PDF. How did you create the PDF?

2 Likes

if you check the software manager for “pdf” you’ll recognize there is a bunch of applications to edit,change and convert pdf’s. you need to investigate this.

You may try Pdf Sam, in its Premium features you get an Edit function :

You may also try LibreOffice. Depending on the pdf type, it may import your file properly. You then add header, footer, page number as usual then export as pdf.
It seems that Master pdf Editor can not do what you look for.

1 Like

Some ideas here: https://askubuntu.com/questions/18685/adding-pages-to-existing-pdf-file

Hi @marli,

As far as I have it, it will depend on which software you are trying to print it with. Okular, ePDFView, MuPDF, or something else.
It has to be set in the printing dialog as part of the options, if I remember correctly.

Sent by mail from from city administration. They had it in their archive, without page numbers

Yes. That’s what I used to do in windows. As I dished windows some years ago I need a linux solution.
There are lots of pdf viewer software out there. At least one should have this option. Question is which on has such function?

Thars only about combining pdf’s and/or removing pages from pdf. They don’t say anything about adding content to each page.

So i guess it does not have Text or Structure to be recognized by software (without OCR).
If you want to add header and footer as an overlay. Master PDF Editor can do that and is available as Flatpak or from AUR by Pamac. ( as @Denis_Pom already suggested)

Of course you could use any TeX program and embed the PDF within while defining header and footer around, but that would scale down the content and require more technical knowledge.

I have never had this requirement, so is quite possibly wrong and can’t help you.

However, from what I could see quickly, xreader looks relatively full-featured. So you could try that. It’s in the extra repository:

$ pamac search xreader
[...]
xreader  4.0.2-1                                                           extra
    Document viewer for files like PDF and Postscript. X-Apps Project.

So can be installed using

pamac install xreader

Hope it helps!

1 Like

Stirling-PDF can add page numbers but you either have to find a public instance or install it yourself, e.g. with docker:

EDIT: It’s very easy. Upload the PDF and say in which corner you want the page numbers.

Libreoffice opens pdf i Draw. (Even if I select open from the file menu in writer)
Draw gives to option to add a text field containing page number. Numbering is automatic. But the text field has to be added manually to each page. There is no header/footer option in draw.
Pages from Draw can be copied over to a writer document as a image. Writer can have footer/header containing page number. But the image from draw comes on top of the header/footer. Even when you select that the image should come behind everything else (bring to back). So, unless the image is shrinked, the page number is not visible.

Writer is a text editor specifically for formatted text like docx or richtext. For writer PDF is only an export format, not a workfile.

The whole idea about the PDF file format was to have an non changing non editable file format. This is not true to the full extend these days, but the ability to change/edit PDF files is limited.
That’s why is was asking for the original file format, but as said, Master PDF Editor does what you need, I just checked it with some scanned documents.

This would likely be the case with most PDF related packages you might use. I suggest that unless you are prepared to process each page one by one, you might be out of luck. A possible workaround might be to use an annotation feature of some program while scanning each page (you would have needed to first print the PDF file in order to scan the pages). Unfortunately, the result would likely be a series of images, rather than accessible text.

That said, you may very well have some success using an often forgotten application abiword - it’s fundamentally a word processor, however, its PDF editing capabilities may surprise you.

sudo pacman -S abiword

No step-by-step instructions. You’ll just have to experiment.

Convert a PDF to a Word Document:

I also found this guide which explains how to convert a PDF file to a Word document using Abiword, LibreOffice, Calibre, or Okular.

Once converted to a Word document it can be opened in many different word processor applications - this might improve your chances of adding page numbering in a subsequent conversion.

Using Calibre, for example, you might then be able to convert to one of the ebook formats while adding page numbering. You could potentially use Pandoc or TeX to convert the page numbered ebook back to PDF. Of course, you would likely lose any predefined formatting in the process, and you might not want that.

sudo pacman -S calibre
sudo pacman -S okular

There is no doubt a way to achieve what you want, but it may not necessarily be easy.

Master PDF Editor:

I would support using Master PDF Editor as suggested by @Ganimede - however, with one caveat: The downloadable Master PDF Editor packages are demo only - you would need to buy the application to avoid having each file watermarked.

From the Master PDF Editor download page:

Naturally, if having a watermark is not a deal breaker, have at it.

However, there is also an outdated masterpdfeditor-free available in the AUR which the maintainer claims does not have the watermarking annoyance, so this might be worth looking at.

pamac build masterpdfeditor-free

And the lastest retail version masterpdfeditor also available in the AUR:

pamac build masterpdfeditor

:point_right: A quick reminder that the AUR is unsupported in Manjaro.

I hope this helps. Cheers.

2 Likes

I found a webservice that does the job.

Tested with a 8 page pdf and it looks good.

Still looking for software to do this on linux thou.

Here is a guide that might work, using pdftk

The idea is to create a document containing pagenumbers only, then sort of overlay the numbered pages over the original document.

pdftk single_file.pdf multistamp numbers.pdf output single_document_numbered.pdf

Update: installed pdftk from official repo (extra). It’s a java-port of the original pdftk that was discontinued years ago.
For a test I created a document containing blank 10 pages using Libreoffice writer. Added footer with pagenumbers and exported as pdf. Then ran the command above with a 8 page document as original, and got a perfect result of 8 numbered pages (note that the page number document was 10 pages).

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.