使用 pdftk 将图像添加到 pdf [英] Adding an image to a pdf with pdftk
问题描述
您好,我正在使用 pdftk 根据提交的表单生成 PDF.
Hello I am using pdftk to generate a PDF based on a form that is submitted.
在此之前我一切正常.这是添加签名的图像.我正在使用签名板,它非常适合生成签名的图像文件.现在我想将该签名图像添加到 PDF 中?有谁知道这是否可能与pdftk有关?我没有看到这样做的选项.或者,是否甚至可以将图像附加到我在 PDF 中提交的表单?
I have everything working fine until here. Which is adding an image of a signature. I am using signature pad which works great to generate the image file of the signature. Now i am trying to add that signature image to the PDF? Does anyone know if this is even possible to do with pdftk? i don't see the option to do that. Or if its even possible to attach to the image to a form filed that i have in the PDF?
推荐答案
先把图片转成PDF
convert image.png image.pdf
然后使用 pdfjam(另一个免费工具)放大和偏移图像
Then scale up and offset the image using pdfjam (another free tool)
pdfjam --paper 'a4paper' --scale 0.3 --offset '7cm -12cm' image.pdf
然后使用 pdftk 合并两个 PDF
Then combine both PDFs using pdftk
pdftk text.pdf stamp image.pdf output combined.pdf
如果您需要定位图像并将其添加到一般PDF中的一页,您可能需要下载STAMPtk,但您必须为此付费.
You may need to download STAMPtk if you need to position the image and add it to only one page in the general PDF, but this one you have to pay for it.
您可以从这里下载 STAMPtkhttp://www.pdflabs.com/tools/stamptk-the-pdf-stamp-maker/
You can download STAMPtk from here http://www.pdflabs.com/tools/stamptk-the-pdf-stamp-maker/
希望能帮到你!
这篇关于使用 pdftk 将图像添加到 pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!