0

I've 2 A4 pages from pdf.

The first one contain the "content" of the page and second contain header and footer.

Is it possible via command line to merge the content of these 2 pdf pages into a new single one that contains all the element of the 2 pages ?

Coucout
  • 143
  • 6
  • Not sure about commandline, but there are pdf editors that can use one pdf as "background" and merge with another pdf on top. – LPChip Dec 20 '21 at 14:39
  • I think i've founded a possible solution with iText here : https://kb.itextpdf.com/home/it7kb/examples/superimposing-content-from-one-pdf-into-another-pdf – Coucout Dec 20 '21 at 15:28

2 Answers2

1

You can use the watermark command from HexaPDF for this:

$ hexapdf watermark -w header_footer.pdf content.pdf output.pdf
gettalong
  • 156
  • 3
  • Thanks but I see this work in ruby. And I want a standalone program. I've founded one : https://superuser.com/a/1640241/696066 – Coucout Dec 24 '21 at 10:35
  • On macOS Ruby is already present and I guess on many Linux distributions, too. So after installing HexaPDF via `gem install hexapdf`, it just works. But it is not a compiled application, yes. – gettalong Dec 24 '21 at 16:40
0

Thanks to gettalong, I've found the tool qpdf to make this, referenced in this post : https://superuser.com/a/1640241/696066

qpdf --overlay overlay.pdf --repeat=1 -- input.pdf output.pdf
Coucout
  • 143
  • 6