<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Convert all PDF files in a directory to PNG images</title> <atom:link href="http://gehrcke.de/2009/10/convert-all-pdfs-in-a-directory-to-pngs/feed/" rel="self" type="application/rss+xml" /><link>http://gehrcke.de/2009/10/convert-all-pdfs-in-a-directory-to-pngs/</link> <description>Jan-Philip Gehrcke&#039;s website</description> <lastBuildDate>Wed, 12 Oct 2011 13:09:05 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>By: Jan-Philip Gehrcke</title><link>http://gehrcke.de/2009/10/convert-all-pdfs-in-a-directory-to-pngs/comment-page-1/#comment-5854</link> <dc:creator>Jan-Philip Gehrcke</dc:creator> <pubDate>Fri, 13 May 2011 07:18:50 +0000</pubDate> <guid
isPermaLink="false">http://gehrcke.de/?p=1015#comment-5854</guid> <description>Hey Jonathan,
I do not exactly realize what the problem is -- but just two suggestions that could help:
1) At first, try running ghostscript from the commandline (cmd.exe in Windows) yourself. While doing so, convince yourself that the set of commandline parameters you want to use is working as expected.
2) When you are sure, which commandline parameters you need, put them into the Python script (as you have already tried)
3) I would suggest just to append something like &#039;_grayscale&#039; to each filename. Therefore, you could use:
&lt;pre lang=&quot;python&quot;&gt;-sOutputFile=%s_grayscale.pdf % pdfname,&lt;/pre&gt;
This would definitely work. For a subdirectory, you could try
&lt;pre lang=&quot;python&quot;&gt;-sOutputFile=converted/%s.pdf % pdfname,&lt;/pre&gt;
But I am not sure if it works like this or if you would need a full path instead. Furthermore, in case of a subdirectory you would have to add some code that checks if this directory already exists (and which would create it otherwise).
Hope this helps,
Jan-Philip</description> <content:encoded><![CDATA[<p>Hey Jonathan,</p><p>I do not exactly realize what the problem is &#8212; but just two suggestions that could help:</p><p>1) At first, try running ghostscript from the commandline (cmd.exe in Windows) yourself. While doing so, convince yourself that the set of commandline parameters you want to use is working as expected.</p><p>2) When you are sure, which commandline parameters you need, put them into the Python script (as you have already tried)</p><p>3) I would suggest just to append something like &#8216;_grayscale&#8217; to each filename. Therefore, you could use:</p><pre lang="python">-sOutputFile=%s_grayscale.pdf % pdfname,</pre><p>This would definitely work. For a subdirectory, you could try</p><pre lang="python">-sOutputFile=converted/%s.pdf % pdfname,</pre><p>But I am not sure if it works like this or if you would need a full path instead. Furthermore, in case of a subdirectory you would have to add some code that checks if this directory already exists (and which would create it otherwise).</p><p>Hope this helps,</p><p>Jan-Philip</p> ]]></content:encoded> </item> <item><title>By: jonathan</title><link>http://gehrcke.de/2009/10/convert-all-pdfs-in-a-directory-to-pngs/comment-page-1/#comment-5853</link> <dc:creator>jonathan</dc:creator> <pubDate>Fri, 13 May 2011 06:34:29 +0000</pubDate> <guid
isPermaLink="false">http://gehrcke.de/?p=1015#comment-5853</guid> <description>i&#039;ve noticed that the converted pdf file cannot have the same name as the source pdf file else it&#039;ll end up as 3kb file size. if i were to have a folder called &quot;converted&quot; in the same directory, for the line:
&quot;-sOutputFile=%s.pdf&quot; % pdfname,
how can i reference that to place the converted files to &quot;converted&quot; folder? i&#039;ve tried many different methods but to no avail. :(</description> <content:encoded><![CDATA[<p>i&#8217;ve noticed that the converted pdf file cannot have the same name as the source pdf file else it&#8217;ll end up as 3kb file size. if i were to have a folder called &#8220;converted&#8221; in the same directory, for the line:</p><p>&#8220;-sOutputFile=%s.pdf&#8221; % pdfname,</p><p>how can i reference that to place the converted files to &#8220;converted&#8221; folder? i&#8217;ve tried many different methods but to no avail. <img
src='http://gehrcke.de/wp/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: jonathan</title><link>http://gehrcke.de/2009/10/convert-all-pdfs-in-a-directory-to-pngs/comment-page-1/#comment-5852</link> <dc:creator>jonathan</dc:creator> <pubDate>Fri, 13 May 2011 06:00:21 +0000</pubDate> <guid
isPermaLink="false">http://gehrcke.de/?p=1015#comment-5852</guid> <description>hi jan-philip. i&#039;ve tried your code for another purpose and it doesn&#039;t seem to work. my aim is to convert color pdf to grayscale pdf, to reduce filesize. i&#039;ve edited this portion to as such:
arglist = [ghostscriptpath,
&quot;-dBATCH&quot;,
&quot;-dNOPAUSE&quot;,
&quot;-sOutputFile=%s.pdf&quot; % pdfname,
&quot;-sDEVICE=pdfwrite&quot;,
&quot;-sColorConversionStrategy=Gray&quot;,
&quot;-dProcessColorModel=/DeviceGray&quot;,
&quot;-dCompatibilityLevel=1.4&quot;,
pdffilepath]
the python script runs but the converted pdf files don&#039;t show up. also, there should be a delay during each conversion, all of which don&#039;t exist. any thoughts on this? your input&#039;s much appreciated! :D</description> <content:encoded><![CDATA[<p>hi jan-philip. i&#8217;ve tried your code for another purpose and it doesn&#8217;t seem to work. my aim is to convert color pdf to grayscale pdf, to reduce filesize. i&#8217;ve edited this portion to as such:</p><p>arglist = [ghostscriptpath,<br
/> "-dBATCH",<br
/> "-dNOPAUSE",<br
/> "-sOutputFile=%s.pdf" % pdfname,<br
/> "-sDEVICE=pdfwrite",<br
/> "-sColorConversionStrategy=Gray",<br
/> "-dProcessColorModel=/DeviceGray",<br
/> "-dCompatibilityLevel=1.4",<br
/> pdffilepath]</p><p>the python script runs but the converted pdf files don&#8217;t show up. also, there should be a delay during each conversion, all of which don&#8217;t exist. any thoughts on this? your input&#8217;s much appreciated! <img
src='http://gehrcke.de/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p> ]]></content:encoded> </item> </channel> </rss>
<!-- Dynamic page generated in 0.342 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2011-11-22 08:21:44 -->

