Friday, August 14, 2009

linux: how to insert an img to pdf files

If you want to insert an image (like your picture, signature etc.) to an existing pdf file and you don't have acrobat professional version (that allows you to edit a pdf file within the software). Then you may be able to use the following steps with combination of different tools that are available in linux:

  1. You have an image file (say, one lovely picture) and one pdf file (Orig.pdf) to which you want to insert your picture
  2. Use "gimp" to open them. For the pdf file, you have to select which page that you want to insert your picture to, and then open the page (NOTE: in order to have good quality and same size as the original page, you may have to set "resolution" as 320. I tried 300 and 400, and realized that 320 is the proper value)
  3. In "gimp", copy your picture on the pdf page. You can use the menu "Layer -> Scale Layer ..." to scale your picture to fit your requirement.
  4. Save your modified pdf page as one "eps" file.
  5. In terminal, convert the eps file to a pdf file by "epstopdf MyPage.eps" to get MyPage.pdf
  6. Then, still in your terminal, use the tool "pdftk" to merge the 2 pdf files (Orig.pdf and MyPage.pdf):
pdftk A=Orig.pdf B=MyPage.pdf cat A1-4 B1 A6-11 output Combined.pdf
where we assume MyPage.pdf will be inserted as Page 5 while totoal pages in Orig.pdf are 11 pages.

Merge pdf files:

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

5 comments:

mirod said...

Thank you, thank you, thank you.

It worked.

So thank you for taking the time to post this, It's the simplest way I have found to add graphics to a page of a PDF document.

BioGeek said...

Thanks! Worked like a charm.

Christian Duncan said...

Might I also suggest that you try Inkscape as well. I just used it and it worked smoothly. Open the two pages then do a copy and paste from one to the other. Again, it only works for one page so you might need to do the PDF merge if you want multiple pages.

I was even able to make the background of the signature file transparent so it blended smoothly with the original PDF.

Tee Chess said...

I wanted to insert a signature to the existing pdf file but is not having the appropriate acrobat professional version that allows me to edit the PDF file. I will try these steps that you have mentioned to do this task. Thanks a lot for helping me out.
PDF signature

julz fabros said...

For Fillable PDF Forms or any kinds of Fillable Forms please visit our website PDFfiller.com. For Fillable Form you may follow this link -
http://goo.gl/ZjvJvs
You can edit your PDF form, fill the text fields, add a variety of checkmarks, digitally eSign the PDF form and even add pictures. After your PDF form is completed, it can be printed, emailed, faxed or saved on your computer. You can even send fillable PDF forms to your customers, employees, vendors and partners. Convert Microsoft Office files into PDF file by using PDFfiller.com. Try it!

Locations of visitors to this page