Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding an image to a pdf with pdftk

Tags:

Hello I am using pdftk to generate a PDF based on a form that is submitted.

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?

like image 579
Brad Hazelnut Avatar asked Dec 11 '13 22:12

Brad Hazelnut


1 Answers

First convert the image to PDF

convert image.png image.pdf 

Then scale up and offset the image using pdfjam (another free tool)

pdfjam --paper 'a4paper' --scale 0.3 --offset '7cm -12cm' image.pdf 

Then combine both PDFs using pdftk

pdftk text.pdf stamp image.pdf output combined.pdf 

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.

You can download STAMPtk from here http://www.pdflabs.com/tools/stamptk-the-pdf-stamp-maker/

I hope it helps!

like image 107
Salvi Pascual Avatar answered Sep 20 '22 08:09

Salvi Pascual