During my document management on Linux, most of the time the easiest way is to split PDF documents to pages and then merge them together with one signed, scanned page.
In this blog post I will show how to do this with Linux terminal.
We will need pdftoppm which is part of poppler-utils package.
If your distribution doesn't come with it preinstalled, you can get it with command:
sudo apt-get install poppler-utils
To split PDF document to images per page run:
pdftoppm input.pdf out -png
For merging them back we can use convert command-line tool:
convert out1.png out2.png signed.png document.pdf
convert comes with imagemagick package:
sudo apt-get install imagemagick
Depending on your Linux distribution and package versions you may get permission error stating:
convert-im6.q16: not authorized `filename.pdf' @ error/constitute.c/WriteImage/1037.
This is caused by policy which defends against Ghostscript vulnerability. The vulnerability is currently fixed but appropriate policy is still in place. The simplest fix is to run:
sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xmlout
That's all for now. Time by time I will update this manual with new tricks and tips for PDF manipulation.