Occasionally when my scanner is emailing me a PDF it gets corrupted along the way. Most of the time the individual scanned images in the PDF are either perfectly valid or at least can viewed, even though the PDF viewer refuses to open the corrupt PDF file.
The bash script below will extract the images and then combine them again into a valid new PDF file.
Continue reading Recovery of scanned PDF corrupted by email transfer