Ubuntu – How to edit a picture into an existing PDF file


I have a scanned PDF file which is an application form, and a picture which is the scanned version of my signature (for example, this one) and can be in any image format such as EPS or PNG. I would like to put the signature picture on the blank space right to "APPLICANT:" on the second page of the application form. I wonder how to do that?

I have tried the following methods, but none succeeded:

  1. The first way is using gimp. I first import the application form into gimp, and then paste the signature picture on the space right to "APPLICANT:" on the second page of the application form.

    The problems are that:

    • It seems that I can only import one page of the application form into gimp, not all of the two pages.

    • Also when I save the modification, the closest format to PDF I can save to is PS, and the resolution has been downgraded and the storage size of the saved file is 10 times bigger than the original application form and the signature picture.

  2. The second way is using Libreoffice Draw. I have installed the libreoffice-pdfimport package. But after I import the application form into Libreoffice Draw,

    • all the scanned content is not imported, and

    • the layout is different from the layout of the original
      application form.

So what other ways can I try? I would prefer some way that can lay the signature picture directly on the application form PDF file,

  • without having to convert between formats,
  • without having to create much bigger files while keeping the original resolution,
  • without having to split and combine pages of a multi-page pdf file,
  • without having to rasterize other parts of the PDF file, i.e. without losing the text that I added later to the application form PDF file by having to convert the whole PDF into images.

Best Answer

My recommendation is Xournal and its actively developed fork, Xournal++. Here are the instructions.

Install (for Xournal):

sudo apt-get install xournal

For Xournal++ you can use either the stable PPA,

sudo add-apt-repository ppa:apandada1/xournalpp-stable
sudo apt update
sudo apt install xournalpp

or the flatpak,

flatpak install flathub com.github.xournalpp.xournalpp

Run xournal or xournal++, click File>Annotate PDF, choose your PDF file.

Now, go to where you need to add your signature and click Tools>Image (or the "Image" toolbar icon), then click where you want to add the image. An image selection dialog appears, select your image.

Xournal's insert image is a great addition but not polished. As soon as you add the image make sure to resize it and move it to where you want. For resize there's no ability to ensure the proportions stay the same. Just eye it. Once you are done, it is in its own layer, which you cannot change. If you don't like how it ends up delete that layer and start again.

One handy thing is that you can use ctrl-c as soon as you resize it and then ctrl-v the next time you need to insert your image. Assuming you want the same size image this will save you some time.

When you are done choose File->Export to PDF to get it back into the PDF format I assume you'll want for sending your signed doc.

Note: A downside to Xournal is the finished document looks like the fonts are converted to an image. Fonts are no longer as crisp. Still it looks better than if you printed and rescanned and is much faster. [Note: in my most recent experience it seems this problem has been solved. Maybe I just got lucky with the particular fonts used. Please leave a comment abt your experience and I'll update accordingly.] This issue seems to be fixed in Xournal++ version 1.0.20.