Reverse detail from Kakelbont MS 1, a fifteenth-century French Psalter. This image is in the public domain. Daniel Paul O'Donnell

Forward to Navigation

How to save PDF forms without buying proprietary software such as Adobe Acrobat

Posted: Sep 05, 2008 11:09;
Last Modified: Sep 07, 2008 19:09

---

Portable Document Format forms are a fact of life. Many government and university agencies use them, so I am filling them out all the time.

An extremely annoying thing about them, however, is that Adobe does not allow users of its free reader software to save form content electronically (unless the form author has used Acrobat 9 and explicitly given permission to do so), while Evince, the main open source competitor to the Reader, seems unable to let them do so. Since Acrobat (the writer, not the reader), is not available for Linux, and since I object anyway to paying US$ 299 or more to fill in forms, I thought there must be a better way.

A simple solution

Fortunately there is. Linux has always been very good at handling PDF creation. Open Office was for years (may still be) far better and much faster than Word at PDF creation—and it has never required any plugins or additional utilities to work. And Ubuntu ships with “PDF” as a default printer.

This makes saving PDF form content extremely easy: just print to PDF. When you open the output file in a PDF reader, your content is saved.

More complex operations

But what if I want to do more: add a signature image, for example, or fill in fields that won’t accept a cursor (a common feature of many forms where the designer is expecting you to print off the form anyway rather than save it electronically). This too is quite easy to do, though it requires a little bit of rummaging around.

What you need

The basic operation is going to involve the following steps

  1. Printing the typed form content to PDF.
  2. Converting the PDF output to TIFF for image manipulation
  3. Adding the image or other textual content via a graphics program such as the GIMP.
  4. Converting the modified TIFF files back to PDF.

In order to do this, you are going to need ghostscript (already present in a standard Ubuntu and most other Linux installations) and the libtiff set of graphic manipulation utilities (not present by default in Ubuntu, but available via synaptics or apt-get).

After the form has been printed to PDF (or Postscript, which works just as well at this stage), you need to convert it to TIFF format using Ghostscript ([gs]). The following example uses a jpeg filter in order to preserve color information; the other options indicate a 300×300 ppi resolution; and a US letter paper size; the use of the variable %04d in the output file name sets an automatic counter in case the PDF has more than one page (type man gs at the command line to discover other options and values):

 gs -SDEVICE=jpeg -r300x300 -sPAPERSIZE=letter -sOutputFile=OUTPUT_FILE_NAME%04d.tif
   -dNOPAUSE -dBATCH -- INPUT_FILE_NAME.pdf

(of course the example should be typed on a single line at the command prompt).

The individual TIFF files are then available for manipulation in a graphics program like the GIMP.

After you have changed the results of your work in the GIMP, you need to convert the resulting TIFF files back into a single PDF. This is done using tiff2pdf, preceded by tiffcp if your document has more than one page. For example, the following command converts a single page TIFF image to a single page PDF document. The -z filters indicates that zip compression is desired. -j is also commonly used but never seems to work for me (again type man tiff2pdf to see the various options):

tiff2pdf -z -oOUTPUT_FILE_NAME.pdf INPUT_FILE_NAME.tif

If you have been working with a set of TIFF files and want to convert them to a single PDF document, you must concatenate first them using tiffcp before feeding them through tiff2pdf. The following command builds a multipage TIFF file from the inputs *_001.tif through *_002.tiff:

tiffcp INPUT_FILE_NAME_001.tif INPUT_FILE_NAME_002.tif OUTPUT_FILENAME.tif

This mutipage TIFF output file can then be converted to a multipage PDF using tiff2pdf as in the preceding example. Presumably you also could use a pipe to feed the output of tiffcp directly to tiff2pdf.

----  

Comment [3]

  1. rhombus (Wed Jun 16, 2010 (14:51:41)) [PermLink]:

    This isn’t actually what most people need.

    They need to be able to save the form, then open it and change entries at a later time.

  2. dan (Tue Jun 22, 2010 (11:04:28)) [PermLink]:

    rhombus:

    I don’t know that I’ve never needed that capability myself. My more common problem is that I need to save the form electronically in order to email it back.

    But I did recently do something similar using Open Office, which seems to read PDF forms now. You lose any graphics, but otherwise the basic elements show up.

  3. MM (Tue Mar 1, 2011 (15:30:54)) [PermLink]:

    This is a useless solution..

:
:

:

Textile help

Back to content

Search my site

Sections

Current teaching

Recent changes to this site

Tags

anglo-saxon studies, caedmon, citation, citation practice, citations, composition, computers, digital humanities, digital pedagogy, exercises, grammar, history, moodle, old english, pedagogy, research, student employees, students, study tips, teaching, tips, tutorials, unessay, universities, university of lethbridge

See all...

Follow me on Twitter

At the dpod blog