Empty object 15 in pdf (pdf.c)
Posted: 2007-06-11T06:14:59-07:00
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
Can you please give us feedback if this will be applied ?
Markus
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.
*/
Markus