repair corrupted PDF

3

1

I have already looked at:

I tried ghostscript on both OS X and Windows. OS X gs gave the following error:

GPL Ghostscript 9.06 (2012-08-08) Copyright (C) 2012 Artifex Software, Inc.  All rights reserved. 
This software comes with NO WARRANTY: see the file PUBLIC for details. 

Error: /undefined in  600Ru600D0Fl0Ol2Al7Hl0Sl1Xl8c1E0x0Y0t5760x7680Y0M 
Operand stack:
Execution stack:   
%interp_exit   .runexec2   --nostringval--  --nostringval--   --nostringval--   2   
%stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   
%stopped_push   1894   1   3   
%oparray_pop   1893   1   3   
%oparray_pop   1877   1   3   
%oparray_pop   1771   1   3   
%oparray_pop   --nostringval--   
%errorexec_pop   .runexec2  --nostringval--   --nostringval--   --nostringval--   2   
%stopped_push   --nostringval-- 
Dictionary stack:   
--dict:1161/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)-- 
Current allocation mode is local Current file position is 677 
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

Neither Acrobat Reader nor pro will load the file. I also tried the "Recovery Toolbox for PDF" on the Windows side, with no love.

Any ideas? Am I munging my ghostscript commandline? Here's the two commands I tried:

gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress corrupt.pdf

and

gs -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=repaired.pdf corrupt.pdf

Joe B

Posted 2012-11-08T18:23:54.077

Reputation: 31

2How do you know it is corrupted? What is happening when you try to open/view the PDF? – Paperlantern – 2012-11-08T18:29:14.853

I see where you just said it won't load, but do you get an error? Often times on difficult PDFs I find the PDF viewer built into Linux Mint is extremely resilient and can open files that other programs just cant seem to get their heads around. Reprinting it to PDF from Mint makes a clean pdf that the other programs can then use. I do this many times a month for users at my work. – Paperlantern – 2012-11-08T18:35:42.517

Error is: "filename.pdf" Could not be opened. It may be damaged or use a file format that Preview doesn't recognize. Acrobat on Windows gives: Reader could not open filename because it is either not a supported file type of because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded). – Joe B – 2012-11-08T23:08:20.203

Try pdftk and qpdf. – Reinstate Monica - M. Schröder – 2012-11-09T08:08:45.263

pdftk reports "Error: Failed to open PDF file: filename" I'm willing at this point to assume that the pdf is beyond saving, but thank you everyone for trying! I apprecate your help, and so does my user whose file it was. If you appreciate how much effort I put in, please vote my question up, since I'd love to have more than 6 reputation... ;) Cheers, – Joe B – 2012-11-09T20:08:36.197

Answers

0

Some PDF files are beyond repair. Adobe have put a lot of resources into ensuring that Adobe Reader and Acrobat can display malformed PDF files, so if Acrobat cannot load the PDF then it is most likely unrecoverable.

If you get the error message:

Reader could not open filename because it is either not a supported file type of because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

Then the PDF has been mangled and the %PDF-header (e.g. usually something like %PDF-1.6 at the very top of the file when viewing in a text editor) cannot be found within the first 1024 bytes of the file.

Here's some more information from Adobe:

Error: "The document is damaged..." | Opening PDF

Rowan

Posted 2012-11-08T18:23:54.077

Reputation: 942