Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] repair damaged pdf?
Date: Thu, 14 Apr 2011 21:31:38
Message-Id: 4DA76759.7050606@binarywings.net
In Reply to: [gentoo-user] repair damaged pdf? by Liviu Andronic
1 Am 14.04.2011 23:08, schrieb Liviu Andronic:
2 > Dear all
3 > What is your experience with corrupted PDF files? Do you know any tool
4 > that can attempt to repair damaged PDF files? Does it make any sense
5 > to edit a PDF file in hex mode?
6 >
7 > I have a damaged PDF that cannot be opened with any of the about 10
8 > tools that I've just tried.
9 > liv@liv-laptop:/tmp$ pdf2ps Class\ 1.pdf
10 > **** Warning: File has a corrupted %%EOF marker, or garbage after %%EOF.
11 > **** Warning: An error occurred while reading an XREF table.
12 > **** The file has been damaged. This may have been caused
13 > **** by a problem while converting or transfering the file.
14 > **** Ghostscript will attempt to recover the data.
15 > Error: /typecheck in --run--
16 > Operand stack:
17 > --nostringval-- --nostringval-- 1
18 > Execution stack:
19 > %interp_exit .runexec2 --nostringval-- --nostringval--
20 > --nostringval-- 2 %stopped_push --nostringval--
21 > --nostringval-- --nostringval-- false 1 %stopped_push 1878
22 > 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3
23 > %oparray_pop --nostringval-- --nostringval-- --nostringval--
24 > --nostringval-- --nostringval-- --nostringval--
25 > Dictionary stack:
26 > --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)--
27 > --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)--
28 > --dict:20/25(L)-- --dict:1/10(L)--
29 > Current allocation mode is local
30 > GPL Ghostscript 8.71: Unrecoverable error, exit code 1
31 >
32 > liv@liv-laptop:/tmp$ pdftops Class\ 1.pdf
33 > Error: PDF file is damaged - attempting to reconstruct xref table...
34 > Error: Top-level pages object is wrong type (null)
35 > Error: Couldn't read page catalog
36 >
37 > Any ideas how I could try to repair it? (It's not sensitive and it's
38 > small, so I could post it.) I tried pdftk, but it also fails.
39 > liv@liv-laptop:/tmp$ pdftk Class\ 1.pdf output Class\ 11.pdf
40 > java.lang.NullPointerException
41 > at com.lowagie.text.pdf.PdfReader$PageRefs.iteratePages(itext-2.1.7.jar.so)
42 > at com.lowagie.text.pdf.PdfReader$PageRefs.readPages(itext-2.1.7.jar.so)
43 > at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
44 > at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
45 > at com.lowagie.text.pdf.PdfReader.readPages(itext-2.1.7.jar.so)
46 > at com.lowagie.text.pdf.PdfReader.readPdf(itext-2.1.7.jar.so)
47 > at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
48 > at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
49 > Error: Unexpected Exception in open_reader()
50 > Error: Failed to open PDF file:
51 > Class 1.pdf
52 > Errors encountered. No output created.
53 > Done. Input errors, so no output created.
54 >
55 > Regards
56 > Liviu
57 >
58 >
59
60 Well, you could try app-text/qpdf from the benf overlay. It has an
61 option to suppress recovery of damaged files so it looks like it at
62 least tries to repair them per default.
63
64 If you don't want to install layman and overlays, you can send me the
65 file off-list and I take a look.
66
67 One good thing about PDF is that its structure is stored uncompressed
68 (AFAIK it only compresses text and binary data with zlib since version
69 1.2). This means that it might be at least partially recoverable.
70
71 Regards,
72 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] repair damaged pdf? Mick <michaelkintzios@×××××.com>
Re: [gentoo-user] repair damaged pdf? Florian Philipp <lists@×××××××××××.net>