Certain PDFs giving the conversion trouble?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
OLTech778
Posts: 4
Joined: 2017-09-13T10:07:08-07:00
Authentication code: 1151

Certain PDFs giving the conversion trouble?

Post by OLTech778 » 2017-09-13T10:21:19-07:00

Hey all!

I'm trying to convert a particular PDF that is a combination of vector images + text into a raster image (preferrably PNG w/ an alpha layer), and it generally takes 80 seconds with the following command:

convert -density 300x300 "C:\im\files\pdfFile.pdf" -resize 180x180 -flatten -quality 100 -profile "C:\im\sRGB.icc" "C:\im\output\converted.png"

My bet is that the problem lies with the text in the file because of the font that is used -- probably causing a huge issue on the vector end of things.

Any suggestions for intermediate steps that could be used to cut the time it takes to successfully convert the file into an image?

Looking for 10 seconds or less total time, but honestly any improvement is welcomed at this point!

Here is the problematic file: https://drive.google.com/file/d/0B0HRnS ... sp=sharing

Thank you so much!

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Certain PDFs giving the conversion trouble?

Post by fmw42 » 2017-09-13T11:35:33-07:00

It is not your processing, but the file itself. Just reading it to get information takes a long time.

time identify cap.pdf
cap.pdf PDF 612x792 612x792+0+0 16-bit sRGB 50671B 0.000u 0:00.000

real 1m5.382s
user 1m4.830s
sys 0m0.451s

OLTech778
Posts: 4
Joined: 2017-09-13T10:07:08-07:00
Authentication code: 1151

Re: Certain PDFs giving the conversion trouble?

Post by OLTech778 » 2017-09-13T12:38:01-07:00

fmw42 wrote:
2017-09-13T11:35:33-07:00
It is not your processing, but the file itself. Just reading it to get information takes a long time.

time identify cap.pdf
cap.pdf PDF 612x792 612x792+0+0 16-bit sRGB 50671B 0.000u 0:00.000

real 1m5.382s
user 1m4.830s
sys 0m0.451s
Any idea why this might be the case? Again I'm assuming it's the font of the text that's causing the issue, because this will only cause problems with particular files, generally the ones with fonts that have more going on. I'm just hoping there's a way to get around this issue instead of having to just "deal with how long it takes".

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Certain PDFs giving the conversion trouble?

Post by fmw42 » 2017-09-13T13:54:45-07:00

I do not know. Imagemagick handles PDFs though Ghostscript. So it is likely a Ghostscript font issue. Perhaps GS font library does not include that font. What font are you using?

OLTech778
Posts: 4
Joined: 2017-09-13T10:07:08-07:00
Authentication code: 1151

Re: Certain PDFs giving the conversion trouble?

Post by OLTech778 » 2017-09-13T17:36:41-07:00

I turns out that Inkscape can actually do what I want it to do without any issues. Not sure why there's such a huge difference in the reading of the PDF, but I bet you'll right that it's a lack of the font. Though I feel like that would've been an error altogether. Or at least a notification that the font is not available, at the very least.

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Certain PDFs giving the conversion trouble?

Post by fmw42 » 2017-09-13T18:03:51-07:00

Perhaps GS tries to find a substitute font (without notice) and searches a long time to find one that is close.

OLTech778
Posts: 4
Joined: 2017-09-13T10:07:08-07:00
Authentication code: 1151

Re: Certain PDFs giving the conversion trouble?

Post by OLTech778 » 2017-09-13T18:59:31-07:00

Huh. Interesting way to go about it, I suppose. But again I feel like it should be noted to include some kind of notification that this sort of thing is being done - to help people figure out *why* something is taking so absurdly long to run.

Thanks for the help! :)

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Certain PDFs giving the conversion trouble?

Post by fmw42 » 2017-09-13T19:54:57-07:00

You would have to contact the Ghostscript developers. Imagemagick just uses it and has no control over its error messages.

Post Reply