Text annotations and image additions to PDF file using free software
PDF files appear to open in LibreOffice Draw. I did nothing special other than open the file like so:
$ libreoffice carcut_01.pdf
Once in LibreOffice Draw I simply annotated the PDF as if it were a normal document/image. Once done I clicked the PDF icon in Draw's toolbar to export the file out as a new PDF file.
This was the result of my effort.
But LibreOffice doesn't work for me?
If you're encountering an issue with Draw not being able to do this (I was using version of LibreOffice):
- Version: 4.1.4.2
- Build ID: 4.1.4.2-4.fc19
**NOTE:* You might be missing this package which is part of LibreOffice:
$ rpm -aq|grep "libre.*pdf"
libreoffice-pdfimport-4.1.4.2-4.fc19.x86_64
This is what the package looks like on Red Hat based distros such as Fedora. I would assume that on Debian/Ubuntu there is a similarly named package, probably libreoffice-pdfimport
.
Alternatives?
You could try Okular.
Okular allows you to review and annotate your documents. Annotations created in Okular are automatically saved in the internal local data folder for each user. Okular does not implicitly change any document it opens.
screenshot
What else?
As @Terdon's answer shows, you can also use GIMP, along with a whole host of other tools. @Terdon also was kind enough to post this link in our chatroom which has a list of other tools for annotating PDFs as well as viewing them.
Since you just want to overlay text at a predetermined position, you can use pdftk
to do this.
You need two PDF files. One is the PDF file that you want to stamp with the text. The other PDF file is the text you want to stamp. The second one must have a transparent background. You can easily make this with, say, LibreOffice Draw, and print to pdf using cups-pdf. Exporting to PDF—even if you don't select PDF1/A—will make an opaque background.
Then you do:
pdftk input.pdf stamp overlay.pdf output stamped.pdf
If you want different overlays on different pages, create a multi-page overlay.pdf (overlay page 1 goes on input page 1, overlay page 2 on input page 2, etc.) and then:
pdftk input.pdf multistamp overlay.pdf output stamped.pdf
Since screenshots are popular, here is what the input and results look like. The input.pdf was of course made using LibreOffice's all-important smiley tool:
How make a PDF with CUPS-PDF
CUPS-PDF is a print driver for CUPS that creates PDF files from print jobs. To use it, you must be using CUPS. Install the cups-pdf
package (required at least in Debian). Visit the CUPS administrative interface at http://localhost:631/admin
and click 'Add Printer'. You should see "CUPS-PDF (Virtual PDF Printer)" as an option. Select it, press continue. Fill in the queue names, etc and continue again. If asked for a PPD, it's under generic.
Once you've added that printer, it can be fully configured in /etc/cups/cups-pdf.conf
.
To use it, print like normal, but select it as the printer, instead of your normal printer. The PDF file will be plopped into $HOME/PDF
by default.
Okular can make annotations on PDFs, as of the version in Debian 8 (Jessie). This is the version:
okular --version
Qt: 4.8.6
KDE Development Platform: 4.14.2
Okular: 0.20.2
Here is how it works:
For details, see the Annotation reference page from the Okular manual.
To quote that page:
Since Okular 0.15 you can also save annotations directly into PDF files. This feature is only available if Okular has been built with version 0.20 or later of Poppler rendering library.
First, you need to annotate the PDF. You can do this via the menu or via a keystroke. You can find the tools under Tools->Review
, or via the keystroke F6
.
This will bring up a menu on the left, with a variety of options.
Probably the best option for inline annotations is "Inline Note". Follow instructions in the link to save the note. As noted in the link, the background color, font and other features of the note can be customized. See also Change and save pdf annotation setting in Okular?.
By default, the annotation information is stored in in xml files located in
~/.kde/share/apps/okular/docdata
or more generally, in the location
$(kde4-config --localprefix)/share/apps/okular/docdata/
To save the annotation to the PDF file, as is desirable, you need to save the annotations back to the file using Save As
.
The annotation is seen by xpdf and evince (which throws the warning
" WARNING **: Unimplemented annotation: POPPLER_ANNOT_FREE_TEXT. It is a known issue and it might be implemented in the future."
but still shows the annotation), but not by acroread
(9.5.5) or the PDF plugin of Chromium
(45.0.2454.85). It also prints Ok using gtklp
, a CUPS frontend.
A few more tips:
- The Review feature can be added to the toolbar: Settings - Configure toolbars - change under Toolbar: Main Toolbar okular_part - filter available actions by searching "Review", and add it to the current actions to the right.
- The annotations options can be edited, new variants can be added: right click on the Review buttons and select "Configure Annotations"