LWN.net Logo

Manipulating PDFs with the PDF Toolkit (Linux.com)

Scott Nesbitt explores the PDF Toolkit (pdftk) in a Linux.com article. "Creating and reading PDF files in Linux is easy, but manipulating existing PDF files is a little trickier. Countless applications enable you to fiddle with PDFs, but it's hard to find a single application that does everything. The PDF Toolkit (pdftk) claims to be that all-in-one solution. It's the closest thing to Adobe Acrobat that I've found for Linux. Developer Sid Steward describes pdftk as the PDF equivalent of an "electronic staple remover, hole punch, binder, secret decoder ring, and X-ray glasses." That's a lot of functionality for a 4MB application, but the software delivers."
(Log in to post comments)

Manipulating PDFs with the PDF Toolkit (Linux.com)

Posted Apr 27, 2006 23:10 UTC (Thu) by JoeBuck (subscriber, #2330) [Link]

What is vitally needed is a free PDF reader that will allow PDF forms to be filled out interactively; the fill_form CLI interface as described, and the associated kludges to represent the form data, have some uses, but this strikes me as the main hole in free-as-in-freedom PDF implementations: I had to download acroread to do my taxes, for example.

PDF Forms and Free software?

Posted Apr 28, 2006 0:06 UTC (Fri) by dowdle (subscriber, #659) [Link]

Kind of off subject, but Scribus can be used to generate PDFs with interactive form fields... like you were mentioning. Scribus isn't a PDF viewer though.

It would be nice if there was free software that could take a PDF as input and convert it into another format. The full Acrobat (not available for Linux) can do that... or at least that is my understanding... convert a PDF say, into a Microsoft Word document. With OpenOffice.org and various other apps, we can save almost anything to PDF but once it becomes a PDF, it is stuck there.

PDF Forms and Free software?

Posted Apr 28, 2006 1:06 UTC (Fri) by thedevil (subscriber, #32913) [Link]

That's a feature. PDF is a _presentation_ format. Going from PDF to
a format with logical structure (including, yes, Word) necessarily loses
information.

Last I checked, you couldn't covert DVI back to LaTeX, either.

PDF Forms and Free software?

Posted Apr 28, 2006 8:18 UTC (Fri) by boudewijn (subscriber, #14185) [Link]

Well, you can import a pdf in KWord and edit it. Much of the formatting
is lost, but it's an uncommonly handy feature of KWord anyway. I've had
frequent occasion to use it.

PDF Forms and Free software?

Posted Apr 28, 2006 15:10 UTC (Fri) by vmole (guest, #111) [Link]

Scribus can generate PDF forms, but it can't be used to fill in existing PDF forms. Or rather, it couldn't a year ago, last time I tried it.

Scribus

Posted Apr 28, 2006 15:59 UTC (Fri) by dowdle (subscriber, #659) [Link]

I wasn't claiming that Scribus could do more with PDFs than generate them... and it does have the distinction of being the only free program I'm aware of that can create interactive PDF forms.

Scribus

Posted May 5, 2006 9:54 UTC (Fri) by jschrod (subscriber, #1646) [Link]

pdfTeX can create interactive PDF forms as well.

User-level support for that is available in ConTeXt.

Joachim

Manipulating PDFs with the PDF Toolkit (Linux.com)

Posted May 1, 2006 7:42 UTC (Mon) by MortFurd (guest, #9389) [Link]

Check out aipdf:
http://sourceforge.net/projects/aipdf

It seems to be German only, but it does appear to work.

filling pdf forms and adding blocks of text

Posted Apr 28, 2006 4:38 UTC (Fri) by nedludd (guest, #747) [Link]

I need to be able to fill out pdf forms taking data from a database; the CLI interface may well suffice for this. But once the form has the basic information filled in, I would also like to view and further manipulate the result.

In particular, I also need to add small blocks of text in arbitrary places where the designer of the form may not have anticipated, so there may not be a fill-in blank in that spot. When I fill out a form on paper, this isn't hard to do, but with pdf forms it's quite tricky. Here, a graphical interface would be quite helpful. Is there any good way to do this? (I don't know if even the much-vaunted Adobe Acrobat works well for this task; none of the free software tools I've seen seems great for the job.)

filling pdf forms and adding blocks of text

Posted Apr 28, 2006 12:15 UTC (Fri) by dskoll (subscriber, #1630) [Link]

If all you need to add is text, you may be able to convert your filled-in PDF file to Postscript, and then use <a href="http://www.ecademix.com/JohannesHofmann/#flpsed">flpsed</a> to add the text. You can then convert back to PDF.

Of course, the final result no longer contains form fields; it's useful only for presentations.

Annotating PDF

Posted Apr 28, 2006 12:46 UTC (Fri) by NAR (subscriber, #1313) [Link]

When I had to prepare for a formal review of a document, I've used to print the PDF file, then put my comments on the paper so when I went to the meeting, I brought the document on paper and this way I also had my comments there.

Since I got a laptop, there's no need to print the document, because I can bring it on the laptop to the meeting. This is much more enviroment-friendly, but in this case I have to put my comments in a text file, which is just a little awkward. If I had a tool that enabled me to write on the margin of a PDF document, cross out sections or just annotate some way the text, that would be most useful for these reviews.

Bye,NAR

Annotating PDF

Posted May 4, 2006 5:36 UTC (Thu) by pkolloch (subscriber, #21709) [Link]

In Acrobat writer (or how is that package called?) there is some functionality to post notes into a PDF. There is also support for indicating corrections such as inserting new words (a v sign with a popup indicating the words) or striking out a phrase.

I have never used the software myself, but I have received PDFs which were prepared in such a way. Perfect for paper corrections and the like! I had to use the proprietary Acrobat reader to see the corrections though. I'd love functionality like this (viewing and editing) in a Linux application.

Annotating PDF

Posted Feb 15, 2008 23:56 UTC (Fri) by loony (guest, #50568) [Link]

I use "xournal" (gtk-based, if you use debian or (k/x)ubuntu just apt-get 
it). 
It lets me annotate and draw freely onto a 
PDF document. I can then export back to PDF and the annotations are 
preserved. The exported PDF is not converted to pixel based graphics, the 
real text characters are preserved. Very useful tool, also if you are 
using a tablet pc or a wacom tablet.

Wordcount of PDFs?

Posted Apr 28, 2006 12:53 UTC (Fri) by debacle (subscriber, #7114) [Link]

Abusing the issue here: Is there an easy way of counting the words of a PDF document or parts of a PDF document? No need for a 100% correct result, just a good estimation.

Wordcount of PDFs?

Posted Apr 28, 2006 15:42 UTC (Fri) by nix (subscriber, #2304) [Link]

pdftotext | wc -w?

Wordcount of PDFs?

Posted Apr 28, 2006 15:48 UTC (Fri) by debacle (subscriber, #7114) [Link]

I didn't know of pdftotext. I will try it, thanks!

But I digress...

Posted Apr 28, 2006 18:18 UTC (Fri) by ncm (subscriber, #165) [Link]

pdftk is the only Java program on my machine. Built with Gcj, it doesn't depend on a JVM.

Adding comments is also missing

Posted May 5, 2006 9:58 UTC (Fri) by jschrod (subscriber, #1646) [Link]

What's also missing a lot, is the ability to add comments and to sign documents. Especially comment addition is one of the reasons why I still have to use Windows and Acrobat. Is there any free tool that can do this?

Joachim

Adding comments is also missing

Posted May 7, 2006 14:34 UTC (Sun) by dps (subscriber, #5725) [Link]

At a push you could look at pstoedit, which will convert PDF to many formats, including xfig and svg. If what you want is adjusting drawings it might fit the bill. Given a graphic of your signature pstoedit and xfig would definitely allow you to add your signature to a PDF. Of course this further undermines the veracity of signatures.

In a former life I use pstoedit as part of a pic to xfig via eps proccess. pic was much better than xfig for drawing the original figure but xfig was better for the subsequent changes. I suspect pstoedit or pdf2ascii can be used to unredact certain methods of PDF readaction.

Google found at least one (apparently commercial) java program for editing PDF which claims to work on linux.

Adding comments is also missing

Posted May 7, 2006 15:26 UTC (Sun) by jschrod (subscriber, #1646) [Link]

I think I should explain the features that I want, and that are only available in Acrobat and in Jaws PDF Editor, AFAIK.

Comments are a feature of Acrobat: With it, one can add notes to an existing PDF document without changing the text. There is also the possibility to add correction marks (i.e., to denote where text should be changed or added). These correction marks are also additions and no changes, like comments.

This feature is very handy if one has to make editorial comments to a document that one reviews. Converting a PDF document to another format doesn't help here -- I don't want to change drawings and I don't want to change content or formatting. I want to add annotations in a form that is properly displayed in PDF viewers; so that the receiver clearly recognizes what the original text is and what my annotations are.

Signing is also a feature of Acrobat: It is the ability to add a digital signature (something like a PGP signature, but made with X.509 keys/certificates, as in S/MIME or SSL) to the document. With that one asserts that the document is from oneself and the receiver can check if that is really the case and if the document has been changed in the meantime. This is very valuable for official documents, e.g., tenders in public RFPs.

The tools that you posted are very good, and there are many more of them. One of the best is Multivalent, http://multivalent.sourceforge.net/. But still no comment annotations, and no digital signatures.

Best, Joachim

Adding comments is also missing

Posted Sep 18, 2007 16:29 UTC (Tue) by mdg (guest, #47471) [Link]

I came across this while looking for a better way to go about things. As far as I can tell what you are looking for does not exist. What I have found and have been using is a pretty effective work around. You do have to convert the pdf to ps, but this does not lose formatting or allow you to delete text (so the level of authenticity is maintained). The only downfalls in my opinion is first having to do it, then when converting back you usually end up with a substantially larger file, but still manageable. Here it is: flpsed allows you to add text to ps files (pdf2ps to convert then ps2pdf to convert back) The text can be of different colors, you can place it wherever you like. You can also import text from a file. Xfig allows you to add images on top of other images (it treats the pdf as an image) I haven't used it yet, but you might like to use it. Also I found both of these apps from this article: http://www.linux.com/articles/113907 Again I understand that this is not exactly what you are looking for but I hope it helps until what we really want is developed.

Manipulating PDFs with the PDF Toolkit (Linux.com)

Posted May 22, 2009 0:55 UTC (Fri) by JonHayes (guest, #58725) [Link]

I know this is an old post, but someone may find this thread and be helped out as I was....

I use Xournal very successfully.
Just make sure that you select "Annotate PDF" instead of just
opening a file. Then remember to select "Attach pdf" checkbox in the dialog box after selecting the file and before pressing OK!
You will then be able to open your xournal file over and over
and export any changes to a pdf!

JD

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds