Search code examples
pythonimagepdfvector-graphicsinkscape

How to programmatically add a background to a pdf?


Given a .pdf file (produced by Inkscape with the LaTeX option, but I am more focused on the .pdf), is there a way to add programmatically a background (ideally, the background would be a rounded rectangle) to it? I am thinking typically of a python script or a C(or objective-C) library.

Typically:

enter image description here

I guess I should be easier to act directly (maybe via the command line) within Inkscape, but I am looking for a solution on the .pdf


Solution

  • If your background is also a PDF, you can use cpdf:

    cpdf -stamp-under stamp.pdf input.pdf -o out.pdf