Page 1 of 1

Empty object 15 in pdf (pdf.c)

Posted: 2007-06-11T06:14:59-07:00
by baskote
Hi,

converting a jpg to pdf is creating an empty pdf object, which creates an error on acrobat.
The problem happens in pdf.c (ImageMagick 6.3.4), there will be checked for (image->matte != MagickFalse) and only then content will be written. So i patched it and moved the output of the object start and end inside of the if, so it will be printed only if the content is printed too.

-------
14 0 obj
13575
endobj
15 0 obj
endobj
16 0 obj
13575
-------

Here is the patch for ImageMagick 6.3.4

Code: Select all

--- pdf.c.org   2007-06-11 14:31:35.000000000 +0200
+++ pdf.c       2007-06-11 14:29:33.000000000 +0200
@@ -2047,11 +2047,11 @@
     /*
       Write softmask object.
     */
-    xref[object++]=TellBlob(image);
-    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
-    (void) WriteBlobString(image,buffer);
     if (image->matte != MagickFalse)
       {
+        xref[object++]=TellBlob(image);
+        (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
+        (void) WriteBlobString(image,buffer);
         (void) WriteBlobString(image,"<<\n");
         (void) WriteBlobString(image,"/Type /XObject\n");
         (void) WriteBlobString(image,"/Subtype /Image\n");
@@ -2178,8 +2178,9 @@
         }
         offset=TellBlob(image)-offset;
         (void) WriteBlobString(image,"\nendstream\n");
+        (void) WriteBlobString(image,"endobj\n");
       }
-    (void) WriteBlobString(image,"endobj\n");
+
     /*
       Write Length object.
     */
Can you please give us feedback if this will be applied ?

Markus

Re: Empty object 15 in pdf (pdf.c)

Posted: 2007-06-11T07:59:26-07:00
by magick
We applied your patch to ImageMagick 6.3.4-9 Beta available sometime tommorrow. Thanks.

Re: Empty object 15 in pdf (pdf.c)

Posted: 2007-06-13T16:22:49-07:00
by spirofantasio
I have the same problem in converting JPGs into a single PDF file.

I've just downloaded ImageMagick 6.3.4-9 and it does not appear to have solved the problem.

Re: Empty object 15 in pdf (pdf.c)

Posted: 2007-06-14T06:01:26-07:00
by baskote
i checked the version 6.3.4-9 and the fix is included and worked with our jpg images. Are you able to post the examples somewhere and provide more informations about the error you detected and how you have seen the error ?

Re: Empty object 15 in pdf (pdf.c)

Posted: 2009-01-22T18:51:03-07:00
by oddball508
I am having the same problem as this. Does anyone have an answer? I can provide a sample file.