pdf 2 jpg problem: "File has an invalid xref entry"

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
__ct__

pdf 2 jpg problem: "File has an invalid xref entry"

Post by __ct__ »

hi,

i am trying to convert pdfs to jpgs on windows vista using version ImageMagick 6.4.8 2008-12-23 Q16.
it works pretty good, except for some pfds, i get the following error when using -debug option:

**** Warning: File has an invalid xref entry: 4040. Rebuilding xref table.

and then it just hangs and stops converting. as the converting doesnt work with these pdfs on a linux production server also, i assume theres the same problem there. (cant look into it as i dont have shell access)

is this a bug or is the pdf just messed up? and how can i find out? and if it is the pdf, how can i find out what is wrong with it? if needed, i can provide a link to one of those pdfs.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: pdf 2 jpg problem: "File has an invalid xref entry"

Post by magick »

Looks like your PDF may be corrupt and unrecoverable. Post a URL to one or two of your PDF's so we can download and reproduce the problem. Perhaps there is something we can do to gracefully recover from a corrupt PDF.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: pdf 2 jpg problem: "File has an invalid xref entry"

Post by magick »

ImageMagick uses the Ghostscript delegate library or program to render PDF. Ghostscript fails with:
  • -> gs mediamarkt.pdf
    GPL Ghostscript 8.63 (2008-08-01)
    Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
    This software comes with NO WARRANTY: see the file PUBLIC for details.
    **** Warning: File has an invalid xref entry: 4040. Rebuilding xref table.
    Processing pages 1 through 8.
    Page 1
    Error: /rangecheck in --.execform1--
    Operand stack:
    --nostringval-- --dict:6/15(L)-- 2 3 0.0 21.781
    Execution stack:
    %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1905 1 3 %oparray_pop 1904 1 3 %oparray_pop 1888 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 8 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- 120 --nostringval-- 1853 4 11 %oparray_pop --nostringval-- false 1 %stopped_push 1852 4 11 %oparray_pop --nostringval-- (gstatetype) --dict:0/0(L)-- --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- 493 --nostringval-- 1853 5 13 %oparray_pop --nostringval-- false 1 %stopped_push 1852 5 13 %oparray_pop --nostringval-- --nostringval--
Therefore either your PDF is corrupt or there is a bug in Ghostscript.
Titus

Re: pdf 2 jpg problem: "File has an invalid xref entry"

Post by Titus »

Looks like to be the same problem as mine (sorry, I found this thread not until after posting the other one :roll: ):
viewtopic.php?uid=12608&f=3&t=13030

As mentioned in the other thread it seems to be a bug in ghostscript:
http://bugs.ghostscript.com/show_bug.cgi?id=689734

Did you find any solution? Or maybe anyone else?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: pdf 2 jpg problem: "File has an invalid xref entry"

Post by magick »

We tried converting the PDF with Ghostscript 8.60 and we can reproduce the problem. Its still a Ghostscript bug. Checking the processes on our system, Ghostscript had accumlated over 10 minutes of process time before we bailed.
__ct__

Re: pdf 2 jpg problem: "File has an invalid xref entry"

Post by __ct__ »

ok, i now set up my php script the following way

- i send the convert command to the system and save the resulting PID
- if i dont get any response after 30secs, i kill the convert PID and use XPDF for conversion (seems to work, slower and much less comfortable though)

however, with the convert process being killed, the ghostscript process is still running (or lets better say hanging).
i cant kill it with the script, because i dont see how i can obtain the PID of the ghostscript process.

so no i check from time to time, if there are any dead ghostscript processes running and kill them manually, but this is no permanent option

i realize, that this is not strictly imagemagick related, but maybe anyone has any ideas?
Post Reply