Install muPDF
sudo apt-get install mupdf-tools
Repair damaged PDF using command
mutool clean input.pdf output.pdf
The clean command pretty prints and rewrites the syntax of a PDF file. It can be used to repair broken files, expand compressed streams, filter out a range of pages, etc.
mutool clean [options] input.pdf [output.pdf] [pages]
If no output file is specified, it will write the cleaned PDF to “out.pdf” in the current directory.-p passwordUse the specified password if the file is encrypted.-gGarbage collect objects that have no references from other objects. Give the option twice to renumber all objects and compact the cross reference table. Give it three times to merge and reuse duplicate objects.-sRewrite content streams.-dDecompress streams. This will make the output file larger, but provides easy access for reading and editing the contents with a text editor.-lLinearize output. Create a “Web Optimized” output file.-iToggle decompression of image streams. Use in conjunction with -d to leave images compressed.-fToggle decompression of font streams. Use in conjunction with -d to leave fonts compressed.-aASCII Hex encode binary streams. Use in conjunction with -d and -i or -f to ensure that although the images and/or fonts are compressed, the resulting file can still be viewed and edited with a text editor.-zDeflate uncompressed streams. If combined with -d, any decompressed streams will be recompressed. If combined with -a, the streams will also be hex encoded after compression.pagesComma separated list of page numbers and ranges to include.