Page 1 of 1

File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-03-28T06:34:53-07:00
by -tm-
Hi,

have some problems converting to pdf on a windows xp machine with current IM-version 6.3.3 (tried jpg to pdf / pdf to pdf / bmp to pdf) without parameters.

using identify for validating pdf prints the following warning.

Code: Select all

C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>convert -version
Version: ImageMagick 6.3.3 03/23/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>convert LZ.26913LZ.pdf out.pdf
C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>identify out.pdf
   **** Warning:  File has an invalid xref entry:  14.  Rebuilding xref table.
   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> ImageMagick 6.3.3 03/23/07 Q16 http://www.imagemagick.org <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
out.pdf PDF 260x184 260x184+0+0 PseudoClass 256c 16-bit 46.7852kb

C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>convert Clipboard02.jpg out2.pdf
C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>identify out2.pdf
   **** Warning:  File has an invalid xref entry:  14.  Rebuilding xref table.
   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> ImageMagick 6.3.3 03/23/07 Q16 http://www.imagemagick.org <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
out2.pdf PDF 428x322 428x322+0+0 DirectClass 16-bit 403.824kb

C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>convert FEHLEBILD.bmp out3.pdf
C:\Dokumente und Einstellungen\klenk\Eigene Dateien\Eigene Bilder>identify out3.pdf
   **** Warning:  File has an invalid xref entry:  14.  Rebuilding xref table.
   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> ImageMagick 6.3.3 03/23/07 Q16 http://www.imagemagick.org <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
out3.pdf PDF 1080x718 1080x718+0+0 DirectClass 16-bit 2.21862mb 0.031u 0:01
(same happens on a debian pc with IM 6.3.2)

Maybe you can help me soon.

tia
-tm-

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-03-29T07:18:43-07:00
by -tm-
Hi again.

Can anyone reproduce this problem and confirm that this is a bug.
If this problem was reported before, which thread shall I read therefore (could not find it)?
My problem is, that those pdfs cannot be parsed with 'com.etymon.pj.Pdf'.

pls help me.

-tm-

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-03-29T08:00:41-07:00
by -tm-
It seems as if convert adds unused objects in document (empty ones) and double entry in xref table. In my test-pdf I found this one near the xref table.
16 0 obj
endobj

and
0001224055 00000 n
0001224055 00000 n

in

Code: Select all

xref
0 18
0000000000 65535 f 
0000000010 00000 n 
0000000179 00000 n 
0000000228 00000 n 
0000000287 00000 n 
0000000492 00000 n 
0000000583 00000 n 
0000000601 00000 n 
0000000639 00000 n 
0000000747 00000 n 
0001206336 00000 n 
0001206360 00000 n 
0001206387 00000 n 
0001224033 00000 n 
0001224055 00000 n 
0001224055 00000 n 
0001224077 00000 n 
0001224093 00000 n 
trailer
<<
/Size 18
/Info 1 0 R
/Root 2 0 R
>>
startxref
1224115
-tm-

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-04-03T06:57:25-07:00
by baskote
I found the problem in coders/pdf.c

the "object" counter will be increased without outputing content.
The object counter has to be decreased again, or the increasing is moved inside the if. I moved it inside the if.


Here is the patch

-

Code: Select all

-- pdf.c       2007-04-03 15:33:53.000000000 +0200
+++ pdf.c.org   2007-04-03 15:15:13.000000000 +0200
@@ -1989,10 +1989,10 @@
       (unsigned long) offset);
     (void) WriteBlobString(image,buffer);
     (void) WriteBlobString(image,"endobj\n");
+    xref[object++]=TellBlob(image);
     if ((image->storage_class != DirectClass) && (image->colors <= 256) &&
         (compression != FaxCompression) && (compression != Group4Compression))
       {
-        xref[object++]=TellBlob(image);
         /*
           Write Colormap object.
         */

Can the imagemagick guys give us a feedback if this will be applied ?


Markus

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-04-03T07:18:06-07:00
by baskote
Hi,

i forgot, patch file created on Version ImageMagick-6.3.3-5.tar.gz


Markus

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-04-03T07:29:59-07:00
by magick
The patch has been applied to the ImageMagick subversion repository. It will be in the next point release within a week or so.

Re: File has an invalid xref entry: 14. Rebuilding xref table.

Posted: 2007-04-03T08:01:24-07:00
by -tm-
thanx so far.