开发者

Aligning two PDFs for a merge using Cairo and pyPDF

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 PDFSu开发者_StackOverflow社区rface 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?


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: Are PDF box coordinates relative or absolute?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜