* [gentoo-user] repair damaged pdf?
@ 2011-04-14 21:08 Liviu Andronic
2011-04-14 21:30 ` Florian Philipp
0 siblings, 1 reply; 5+ messages in thread
From: Liviu Andronic @ 2011-04-14 21:08 UTC (permalink / raw
To: gentoo-user
Dear all
What is your experience with corrupted PDF files? Do you know any tool
that can attempt to repair damaged PDF files? Does it make any sense
to edit a PDF file in hex mode?
I have a damaged PDF that cannot be opened with any of the about 10
tools that I've just tried.
liv@liv-laptop:/tmp$ pdf2ps Class\ 1.pdf
**** Warning: File has a corrupted %%EOF marker, or garbage after %%EOF.
**** Warning: An error occurred while reading an XREF table.
**** The file has been damaged. This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
Error: /typecheck in --run--
Operand stack:
--nostringval-- --nostringval-- 1
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval--
--nostringval-- --nostringval-- false 1 %stopped_push 1878
1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3
%oparray_pop --nostringval-- --nostringval-- --nostringval--
--nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)--
--dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)--
--dict:20/25(L)-- --dict:1/10(L)--
Current allocation mode is local
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
liv@liv-laptop:/tmp$ pdftops Class\ 1.pdf
Error: PDF file is damaged - attempting to reconstruct xref table...
Error: Top-level pages object is wrong type (null)
Error: Couldn't read page catalog
Any ideas how I could try to repair it? (It's not sensitive and it's
small, so I could post it.) I tried pdftk, but it also fails.
liv@liv-laptop:/tmp$ pdftk Class\ 1.pdf output Class\ 11.pdf
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfReader$PageRefs.iteratePages(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader$PageRefs.readPages(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader.readPages(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader.readPdf(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
Error: Unexpected Exception in open_reader()
Error: Failed to open PDF file:
Class 1.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.
Regards
Liviu
--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] repair damaged pdf?
2011-04-14 21:08 [gentoo-user] repair damaged pdf? Liviu Andronic
@ 2011-04-14 21:30 ` Florian Philipp
2011-04-14 22:03 ` Mick
2011-04-15 8:06 ` Florian Philipp
0 siblings, 2 replies; 5+ messages in thread
From: Florian Philipp @ 2011-04-14 21:30 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 3319 bytes --]
Am 14.04.2011 23:08, schrieb Liviu Andronic:
> Dear all
> What is your experience with corrupted PDF files? Do you know any tool
> that can attempt to repair damaged PDF files? Does it make any sense
> to edit a PDF file in hex mode?
>
> I have a damaged PDF that cannot be opened with any of the about 10
> tools that I've just tried.
> liv@liv-laptop:/tmp$ pdf2ps Class\ 1.pdf
> **** Warning: File has a corrupted %%EOF marker, or garbage after %%EOF.
> **** Warning: An error occurred while reading an XREF table.
> **** The file has been damaged. This may have been caused
> **** by a problem while converting or transfering the file.
> **** Ghostscript will attempt to recover the data.
> Error: /typecheck in --run--
> Operand stack:
> --nostringval-- --nostringval-- 1
> Execution stack:
> %interp_exit .runexec2 --nostringval-- --nostringval--
> --nostringval-- 2 %stopped_push --nostringval--
> --nostringval-- --nostringval-- false 1 %stopped_push 1878
> 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3
> %oparray_pop --nostringval-- --nostringval-- --nostringval--
> --nostringval-- --nostringval-- --nostringval--
> Dictionary stack:
> --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)--
> --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)--
> --dict:20/25(L)-- --dict:1/10(L)--
> Current allocation mode is local
> GPL Ghostscript 8.71: Unrecoverable error, exit code 1
>
> liv@liv-laptop:/tmp$ pdftops Class\ 1.pdf
> Error: PDF file is damaged - attempting to reconstruct xref table...
> Error: Top-level pages object is wrong type (null)
> Error: Couldn't read page catalog
>
> Any ideas how I could try to repair it? (It's not sensitive and it's
> small, so I could post it.) I tried pdftk, but it also fails.
> liv@liv-laptop:/tmp$ pdftk Class\ 1.pdf output Class\ 11.pdf
> java.lang.NullPointerException
> at com.lowagie.text.pdf.PdfReader$PageRefs.iteratePages(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader$PageRefs.readPages(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader.readPages(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader.readPdf(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
> at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
> Error: Unexpected Exception in open_reader()
> Error: Failed to open PDF file:
> Class 1.pdf
> Errors encountered. No output created.
> Done. Input errors, so no output created.
>
> Regards
> Liviu
>
>
Well, you could try app-text/qpdf from the benf overlay. It has an
option to suppress recovery of damaged files so it looks like it at
least tries to repair them per default.
If you don't want to install layman and overlays, you can send me the
file off-list and I take a look.
One good thing about PDF is that its structure is stored uncompressed
(AFAIK it only compresses text and binary data with zlib since version
1.2). This means that it might be at least partially recoverable.
Regards,
Florian Philipp
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] repair damaged pdf?
2011-04-14 21:30 ` Florian Philipp
@ 2011-04-14 22:03 ` Mick
2011-04-14 22:21 ` Liviu Andronic
2011-04-15 8:06 ` Florian Philipp
1 sibling, 1 reply; 5+ messages in thread
From: Mick @ 2011-04-14 22:03 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 1044 bytes --]
On Thursday 14 April 2011 22:30:01 Florian Philipp wrote:
> Am 14.04.2011 23:08, schrieb Liviu Andronic:
> > Dear all
> > What is your experience with corrupted PDF files? Do you know any tool
> > that can attempt to repair damaged PDF files? Does it make any sense
> > to edit a PDF file in hex mode?
> >
> > I have a damaged PDF that cannot be opened with any of the about 10
> > tools that I've just tried.
> Well, you could try app-text/qpdf from the benf overlay. It has an
> option to suppress recovery of damaged files so it looks like it at
> least tries to repair them per default.
>
> If you don't want to install layman and overlays, you can send me the
> file off-list and I take a look.
>
> One good thing about PDF is that its structure is stored uncompressed
> (AFAIK it only compresses text and binary data with zlib since version
> 1.2). This means that it might be at least partially recoverable.
You can also try pdfclean in case it reads it, from the package app-text/mupdf
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] repair damaged pdf?
2011-04-14 22:03 ` Mick
@ 2011-04-14 22:21 ` Liviu Andronic
0 siblings, 0 replies; 5+ messages in thread
From: Liviu Andronic @ 2011-04-14 22:21 UTC (permalink / raw
To: gentoo-user; +Cc: Mick
On Fri, Apr 15, 2011 at 12:03 AM, Mick <michaelkintzios@gmail.com> wrote:
> You can also try pdfclean in case it reads it, from the package pap-text/mupdf
>
It does seem to input it, since it outputed a non-null file, but it
also seems corrupted:
>"/usr/local/build/mupdf-0.8.15-linux-amd64/pdfclean" "/tmp/Class 1.pdf" (1173)
+ mupdf/pdf_xref.c:63: pdf_readstartxref(): cannot find startxref
| mupdf/pdf_xref.c:493: pdf_loadxref(): cannot read startxref
\ mupdf/pdf_xref.c:549: pdf_openxrefwithstream(): trying to repair
warning: object missing 'endobj' token
>"/usr/local/build/mupdf-0.8. ... /pdfclean" "/tmp/Class 1.pdf" (1173) returned '0'
liv@liv-laptop:/tmp$ pdftops out.pdf
Error: Top-level pages object is wrong type (null)
Error: Couldn't read page catalog
Regards
Liviu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] repair damaged pdf?
2011-04-14 21:30 ` Florian Philipp
2011-04-14 22:03 ` Mick
@ 2011-04-15 8:06 ` Florian Philipp
1 sibling, 0 replies; 5+ messages in thread
From: Florian Philipp @ 2011-04-15 8:06 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 4000 bytes --]
Am 14.04.2011 23:30, schrieb Florian Philipp:
> Am 14.04.2011 23:08, schrieb Liviu Andronic:
>> Dear all
>> What is your experience with corrupted PDF files? Do you know any tool
>> that can attempt to repair damaged PDF files? Does it make any sense
>> to edit a PDF file in hex mode?
>>
>> I have a damaged PDF that cannot be opened with any of the about 10
>> tools that I've just tried.
>> liv@liv-laptop:/tmp$ pdf2ps Class\ 1.pdf
>> **** Warning: File has a corrupted %%EOF marker, or garbage after %%EOF.
>> **** Warning: An error occurred while reading an XREF table.
>> **** The file has been damaged. This may have been caused
>> **** by a problem while converting or transfering the file.
>> **** Ghostscript will attempt to recover the data.
>> Error: /typecheck in --run--
>> Operand stack:
>> --nostringval-- --nostringval-- 1
>> Execution stack:
>> %interp_exit .runexec2 --nostringval-- --nostringval--
>> --nostringval-- 2 %stopped_push --nostringval--
>> --nostringval-- --nostringval-- false 1 %stopped_push 1878
>> 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3
>> %oparray_pop --nostringval-- --nostringval-- --nostringval--
>> --nostringval-- --nostringval-- --nostringval--
>> Dictionary stack:
>> --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)--
>> --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)--
>> --dict:20/25(L)-- --dict:1/10(L)--
>> Current allocation mode is local
>> GPL Ghostscript 8.71: Unrecoverable error, exit code 1
>>
>> liv@liv-laptop:/tmp$ pdftops Class\ 1.pdf
>> Error: PDF file is damaged - attempting to reconstruct xref table...
>> Error: Top-level pages object is wrong type (null)
>> Error: Couldn't read page catalog
>>
>> Any ideas how I could try to repair it? (It's not sensitive and it's
>> small, so I could post it.) I tried pdftk, but it also fails.
>> liv@liv-laptop:/tmp$ pdftk Class\ 1.pdf output Class\ 11.pdf
>> java.lang.NullPointerException
>> at com.lowagie.text.pdf.PdfReader$PageRefs.iteratePages(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader$PageRefs.readPages(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader.readPages(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader.readPdf(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
>> at com.lowagie.text.pdf.PdfReader.<init>(itext-2.1.7.jar.so)
>> Error: Unexpected Exception in open_reader()
>> Error: Failed to open PDF file:
>> Class 1.pdf
>> Errors encountered. No output created.
>> Done. Input errors, so no output created.
>>
>> Regards
>> Liviu
>>
>>
>
> Well, you could try app-text/qpdf from the benf overlay. It has an
> option to suppress recovery of damaged files so it looks like it at
> least tries to repair them per default.
>
> If you don't want to install layman and overlays, you can send me the
> file off-list and I take a look.
>
> One good thing about PDF is that its structure is stored uncompressed
> (AFAIK it only compresses text and binary data with zlib since version
> 1.2). This means that it might be at least partially recoverable.
>
> Regards,
> Florian Philipp
>
Okay, qpdf cannot handle this. From a quick inspection of the file you
provided me off-list it looks like the file is split in two. Right there
within "19 0 object" it just ends. I guess this file is the product of
an aborted download?
I guess you could fire up your favorite hex editor and try to add the
necessary stream and object end markers, adjust the length indicator for
the last object and hope that some tool can then do the rest. However,
that's much work for a 36k PDF that is incomplete anyway.
Regards,
Florian Philipp
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-15 8:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 21:08 [gentoo-user] repair damaged pdf? Liviu Andronic
2011-04-14 21:30 ` Florian Philipp
2011-04-14 22:03 ` Mick
2011-04-14 22:21 ` Liviu Andronic
2011-04-15 8:06 ` Florian Philipp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox