Empty object 15 in pdf (pdf.c)

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
baskote

Empty object 15 in pdf (pdf.c)

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

We applied your patch to ImageMagick 6.3.4-9 Beta available sometime tommorrow. Thanks.
spirofantasio

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

Post 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.
baskote

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

Post 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 ?
oddball508

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

Post by oddball508 »

I am having the same problem as this. Does anyone have an answer? I can provide a sample file.
Post Reply