Page 1 of 1

Problem during convertion of pdf

Posted: 2012-02-25T11:32:01-07:00
by VanGog
Hello,
during a convertion of pdf to jpg I found this problem.

I have a document with text. Some pages have text only and some have images.

This command:

Code: Select all

convert doc.pdf -density 400 -quality 100%% -background white "doc.pdf" "d.jpg"
Will make images of pages from the document. Pages, where there are images, they are OK. Very good quality. But the pages, where is text only, they are very bad quality. It look like 35dpi or 75 dpi, but sure not even 3000 dpi which I need. So the text is not possible to read when there is not any image on the page.

Do you have any idea how to solve this problem, please?

Re: Problem during convertion of pdf

Posted: 2012-02-25T11:56:41-07:00
by fmw42
convert doc.pdf -density 400 -quality 100%% -background white "doc.pdf" "d.jpg"
First thing is your second "doc.pdf" near the end is meaningless. You can only have one output image or one input image unless you are combining images or use -write to get another output.

Second, your -background is probably also meaningless. The default is white, but it is a setting and you have no command to use the setting. You could add -flatten. This will only be important if your pdf has transparency.

Third, you need to move the -density before the input image doc.pdf as it is vector format for text and has no density. So you have to set the density while (before) reading the input pdf and not afterwards. So your command should be

convert -density 400 doc.pdf -quality 100%% -background white -flatten "d.jpg"

or if no transparency just

convert -density 400 doc.pdf -quality 100%% "d.jpg"


Try that and let us know if that works. Otherwise, perhaps you could provide an example pdf for us to test.

Also what version of IM and platform are you using. It appears from your syntax that you are on Windows.

Re: Problem during convertion of pdf

Posted: 2012-02-25T12:26:00-07:00
by VanGog
Thank you very much. Yes, I'm on Windows XP. IM version is ImageMagick-6.7.5-Q8.

I checked the files and they look fine and succeeded. Except that I run out of disk space and did not finished the job. Is there a possibility how to change the temp directory for IM? Because it is set to c:\documents and settings/....

Re: Problem during convertion of pdf

Posted: 2012-02-25T12:35:50-07:00
by fmw42
VanGog wrote:Thank you very much. Yes, I'm on Windows XP. IM version is ImageMagick-6.7.5-Q8.

I checked the files and they look fine and succeeded. Except that I run out of disk space and did not finished the job. Is there a possibility how to change the temp directory for IM? Because it is set to c:\documents and settings/....

Sorry, I am not a windows user and don't know how one would do that in any environment. You will need to wait to hear back from one of the IM developers. I suspect there is a way, but I do not know how.

You might review http://www.imagemagick.org/Usage/windows/ and see if Wolfgang has any notes about that.

Somewhere in there he says:

"...the local temporary folder, whose name is stored in the environment variable %TEMP%"

But this does not mean much to me, but it may help you to reset that variable in your environment.

Re: Problem during convertion of pdf

Posted: 2012-02-25T12:51:04-07:00
by VanGog
I now how to set %TEMP% in Windows. It is set to %USERPROFILE%\Local Settings\Temp
but I think if I will set it for example: D:\Temp so it will not work, I would need to restart computer and I think it could cause freeze of computer. Not sure. If some Windows user is here and knows how to reload the new settings to the system, please give advise. I'll better wait till testing some changes to system.

Edit:
So, I changed the directory do D:\Temp but it does not help

Code: Select all

convert.exe: unable to extend cache `C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/magick-h
Aei1zxd-00000085': No space left on device @ error/cache.c/OpenPixelCache/4089.
convert.exe: Too many IDATs found `C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/magick-hAe
i1zxd-00000085' @ error/png.c/MagickPNGErrorHandler/1728.
convert.exe: Corrupt image `C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/magick-hAei1zxd-0
0000085' @ error/png.c/ReadPNGImage/3695.

Re: Problem during convertion of pdf

Posted: 2012-02-25T13:43:07-07:00
by fmw42
I don't know about the other errors, but you have no input image
P:\PROGRAMY\grafika\editace>convert -density 300 -quality 100%% "d.jpg"
convert.exe: missing an image filename `d.jpg' @ error/convert.c/ConvertImageCom
mand/3016.
try

convert -density 300 doc.pdf -quality 100%% d.jpg

Re: Problem during convertion of pdf

Posted: 2012-02-25T13:55:38-07:00
by VanGog
It's OK. I pasted two commands. See the last error:

unable to extend cache

Re: Problem during convertion of pdf

Posted: 2012-02-25T14:44:22-07:00
by fmw42
Sorry, but perhaps we should see the whole command and error messages, though I probably cannot help further. At least then the IM developers will have more to work with.

Re: Problem during convertion of pdf

Posted: 2012-02-25T15:05:54-07:00
by VanGog
The command was the same as you had written, just with quotes:

convert -density 300 doc.pdf -quality 100%% "d.jpg"

as I remember. But I think no need to solve the temp folder problem. Maybe just a command to convert pages 84 - 93 since I have the pages 1 - 83 covert successfully.

This helped

Code: Select all

convert -density 300 doc.pdf[84-93] -quality 100%% "d.jpg"
I have all files converted. Good experience. Thanx for help