views:

123

answers:

1

I need to programmatically add additional graphical elements onto an existing, static PDF book cover. Right now I use pycairo to draw onto a transparent PDFSurface, then merge it into the existing static PDF using pyPdf. This way, the PDFSurface works as an overlay.

However, the transparent PDF is exactly the same size as the static PDF's TrimBox, thus being smaller than the static PDF. How do I position the content on the transparent PDF so that after merging, it exactly overlays the static PDF's TrimBox?

A: 

As would be expected, this was a matter of simple math. It turns out the trouble I was having with aligning the PDF boxes was caused by my wrong interpretation of the box coordinates: http://stackoverflow.com/questions/2288028/are-pdf-box-coordinates-relative-or-absolute

Daniel Werner