I had a corrupted PDF file, print.pdf , that Ghostscript couldn't open, but the usual graphical Linux PDF viewers (Okular, Evince) opened fine. (In my case, the file had garbage at the start instead of a PDF header, when opened in a hex editor.)
These PDF viewers use Poppler as a back-end PDF renderer. So you can repair the PDF using Poppler's command-line tools. In Ubuntu these are in the poppler-utils package. I used:
pdftocairo -pdf print.pdf print_repaired.pdf
which generated a PDF file with correct headers, which tools like Ghostscript now accepted. May use demo soft
Recovery Toolbox for PDF in this
http://www.pdf.recoverytoolbox.com/ for repair pdf.