本文介绍了将图片放置在PDF上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将图像放在特定位置的现有PDF文件上. pdf代表一页的图纸.图像将被缩放.我正在检查ReportLab,但找不到答案.谢谢.
How can I place an image over an existing PDF file at an specific coordinate location. The pdf represents a drawing sheet with one page. The image will be scaled. I'm checking ReportLab but can't find the answer. Thanks.
推荐答案
from pyPdf import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
input1 = PdfFileReader(file("document1.pdf", "rb"))
watermark = PdfFileReader(file("watermark.pdf", "rb"))
input1.mergePage(watermark.getPage(0))
# finally, write "output" to document-output.pdf
outputStream = file("document-output.pdf", "wb")
output.write(input1)
outputStream.close()
我认为它类似于watermark
,有关详细信息,请参见手册
I think it's like watermark
, see the manual for better idea
这篇关于将图片放置在PDF上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!