From: cristy Date: Thu, 3 Feb 2011 18:48:17 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8227 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd6e87b241383020d98f8b54c45d6d451e4f216e;p=imagemagick --- diff --git a/coders/pdf.c b/coders/pdf.c index 91dfd52d0..3e6d9ca96 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -289,7 +289,7 @@ static MagickBooleanType IsPDFRendered(const char *path) static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) { -#define AdobeIllustrator "âãÏÓ" +#define Count "Count" #define CropBox "CropBox" #define DeviceCMYK "DeviceCMYK" #define MediaBox "MediaBox" @@ -332,7 +332,6 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) file; MagickBooleanType - adobe_illustrator, cmyk, cropbox, trimbox, @@ -362,6 +361,7 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) count; size_t + pages, scene, spotcolor; @@ -425,7 +425,7 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) hires_bounds.x2=0.0; hires_bounds.y2=0.0; angle=0.0; - adobe_illustrator=MagickFalse; + pages=0; p=command; for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) { @@ -435,7 +435,7 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) if (c == '\n') c=' '; *p++=(char) c; - if ((c != (int) '/') && (c != (int) '%') && + if ((c != (int) '/') && (c != (int) '%') && ((size_t) (p-command) < (MaxTextExtent-1))) continue; *(--p)='\0'; @@ -447,8 +447,12 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) */ if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0) cmyk=MagickTrue; - if (LocaleNCompare(AdobeIllustrator,command,strlen(AdobeIllustrator)) == 0) - adobe_illustrator=MagickTrue; + if (LocaleNCompare(Count,command,strlen(Count)) == 0) + { + count=strtol(command+6,(char **) NULL,10); + if (count > (ssize_t) pages) + pages=(size_t) count; + } if (LocaleNCompare(SpotColor,command,strlen(SpotColor)) == 0) { char @@ -574,7 +578,7 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) if (cmyk != MagickFalse) delegate_info=GetDelegateInfo("ps:cmyk",(char *) NULL,exception); else - if (adobe_illustrator != MagickFalse) + if (pages <= 1) delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception); else delegate_info=GetDelegateInfo("ps:color",(char *) NULL,exception);