Note: Keep in mind that this was written during the Covid-19 Pandemic.
So, I found myself having to send a signed and scanned document… but paranoid enough to not want to break quarantine to print, sign, and scan a document; I was also doubting that I could simply overlay a copy-pasted signature (because it’s probable that older generations want the document to ‘seem’ that it was scanned).
Long story short… I wanted to create a print-less scan-less signed and scanned document.
Long story long… I went through a lengthy process that consisted of roughly:
- converting PDF to PNG
- adding paper background texture; and whitening (scanners seem to perform some image processing to improve contrast)
- manually signing with GIMP’s ink tool the date and signature for each page
- applying GIMP’s Photocopy effect to make the document seem printed
- slightly rotating each layer to make the document seem that it had some alignment issues
- adding fake scanned frame (paper edges and shadow) from another document I had previously scanned
The only limitation was that the largest paper background texture I found was only 1600×1200 px in size, so my images were a bit small for an A4 document; this allowed for a 136 ppi (around 53.5 dot/cm) A4 document..
Once all that was done, I had to convert the several png images into a single pdf. On my first attempt, after reading the documentation on ImageMagick’s Convert and its convert command-line options, I was trying to do the conversion as follows:
convert -verbose \ -units PixelsPerInch \ -page A4 \ -density 136x136 \ -size 1123x1590 \ -resample 136 \ *.png \ output.pdf
But I was obtaining a document with a reduced size (a B9 document in paper size according to Ubuntu’s Document Viewer, evince). After reading this discussion in the ImageMagick Forum, there seemed to be a 13-year-old bug that was still causing problems. The fix turned out to be:
convert -verbose \ *.png \ -resize 1123x1590 \ -units 'PixelsPerInch' \ -density 136x136 \ output.pdf
That worked like a charm.