Thursday, May 27, 2010

PDF forms on Linux

I will explain a method of filling in forms inside PDF documents for printing or saving (to send, for instance, a signed copy of a contract via e-mail). I've seen other methods described (see here), but I didn't like any of them: most turn the PDF file into an image, which reduces quality and/or increases filesize, and pdfedit seems overly complicated.

Software required: gimp, pdftk.

First split the original pdf into separate pages (this is one disadvantage, pages need to be edited separately):
pdftk file.pdf burst

Next, for each page that needs changing (let's call it page1.pdf), do the following:
  • Import that page in gimp, using whatever dpi you want for any images you are adding (the higher the dpi, the better the quality. Try 300).
  • The page will show up on a new (and only) layer. Do any modifications on separate layers (if you add text, gimp will automatically insert layers, but if you want to use brushes, make sure you create a new layer that you'll edit).
  • When you're done, hide the background layer (the one with the PDF image), and print to a pdf file (say stamp1.pdf).
  • Now, put the newly created pdf on top of the original page:
    pdftk page1.pdf stamp stamp1.pdf
If your PDF was only one page, you're done. Otherwise, you should join all pages together:
pdftk page1.pdf page2.pdf [...] cat output output.pdf

Now all you need is a high-quality copy of your signature :)

No comments:

Post a Comment