The pandemic's not over - but travel is back. I'll even be in China again soon. I prepared the paperwork for my visa application using just a smartphone and some free software. Without access to an office-style printer/scanner, ID cards and passports were the trickiest to scan.
Here's how I did it. I hope this makes the process a little easier for someone else but please bear in mind I'm a nerd who already had the required software installed.
I rely on these free tools to wrangle JPEGs and PDFs:
Since both tools have a lot of dependencies, I install and run them in a Docker container which I can throw away afterwards.
Open a terminal,
cd to some directory in which you'll place your "scanned" images, and fire up the tools:
docker run -ti -v `pwd`:/work -w /work ubuntu:kinetic apt update && apt install -y img2pdf texlive-extra-utils
Passports measure 125mm across; they're covered by ID-3 of ISO/IEC 7810.
We need a one-page PDF containing an image of your passport, at approximately the right size. This is exactly what
img2pdf passport.jpeg -o passport.pdf -S A4 -s 125mm
ID cards (and credit cards, and many others) measure 85.6mm wide; that's ID-1 of ISO/IEC 7810.
I like to place the back and front of ID cards on the same page. Thanks to a nice property of ISO 216, this is straightforward: combine two single-page A5 landscape PDFs into one A4 single-page PDF.
img2pdf front.jpeg -o front.pdf -S A5^T -s 85.6mm img2pdf back.jpeg -o back.pdf -S A5^T -s 85.6mm pdfjam --nup 1x2 front.pdf back.pdf -o idcard.pdf
You may want to supply all your paperwork in one file. This is easy with
pdfjam passport.pdf idcard.pdf -o paperwork.pdf
magick passport.jpeg -scale 800x passport-small.jpeg