Page 1 of 1

Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T10:21:19-07:00
by OLTech778
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!

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T11:35:33-07:00
by fmw42
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

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T12:38:01-07:00
by OLTech778
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".

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T13:54:45-07:00
by fmw42
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?

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T17:36:41-07:00
by OLTech778
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.

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T18:03:51-07:00
by fmw42
Perhaps GS tries to find a substitute font (without notice) and searches a long time to find one that is close.

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T18:59:31-07:00
by OLTech778
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! :)

Re: Certain PDFs giving the conversion trouble?

Posted: 2017-09-13T19:54:57-07:00
by fmw42
You would have to contact the Ghostscript developers. Imagemagick just uses it and has no control over its error messages.