<?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 pdf to image with imagemagick in php	</title>
	<atom:link href="https://www.binarytides.com/convert-pdf-image-imagemagick-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Thu, 21 Nov 2019 14:50:10 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Elvis		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-219545</link>

		<dc:creator><![CDATA[Elvis]]></dc:creator>
		<pubDate>Thu, 21 Nov 2019 14:50:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-219545</guid>

					<description><![CDATA[So Bad... 

Dont work for me :(

In your last example you instantiate the &quot;imagick&quot; object but don&#039;t pass any parameters, is that correct?

Well, I tried passing parameter and not passing, it didn&#039;t work at all.

&#060;?php

$pdf_file   = &#039;\circles-01.pdf&#039;;
$save_to    = &#039;\circles-01.jpg&#039;;

$pdf_file = $_SERVER[&#039;DOCUMENT_ROOT&#039;].$pdf_file;
$save_to = $_SERVER[&#039;DOCUMENT_ROOT&#039;].$save_to;

echo $pdf_file;
echo &#034;&quot;;
echo $save_to;
echo &quot;&quot;;


$img = new imagick(&quot;C:\Users\Windows01\Documents\GitHub\pdf-to-png\public\circles-01.pdf&quot;);
print_r ($img);

//this must be called before reading the image, otherwise has no effect - &quot;-density {$x_resolution}x{$y_resolution}&quot;
//this is important to give good quality output, otherwise text might be unclear
$img-&#062;setResolution(200,200);

//read the pdf
$img-&#062;readImage(&quot;{$pdf_file}[0]&quot;);

//reduce the dimensions - scaling will lead to black color in transparent regions
$img-&#062;scaleImage(800,0);

//set new format
$img-&#062;setImageFormat(&#039;jpg&#039;);

// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions
$img = $img-&#062;flattenImages();

//save image file
$img-&#062;writeImages($save_to, false);

//echo the jpg image
header(&quot;Content-type: image/&quot;.$img-&#062;getImageFormat()); 
echo $img;	//same as echo $img-&#062;getImageBlob();]]></description>
			<content:encoded><![CDATA[<p>So Bad&#8230; </p>
<p>Dont work for me :(</p>
<p>In your last example you instantiate the &#8220;imagick&#8221; object but don&#8217;t pass any parameters, is that correct?</p>
<p>Well, I tried passing parameter and not passing, it didn&#8217;t work at all.</p>
<p>&lt;?php</p>
<p>$pdf_file   = &#039;\circles-01.pdf&#039;;<br />
$save_to    = &#039;\circles-01.jpg&#039;;</p>
<p>$pdf_file = $_SERVER[&#039;DOCUMENT_ROOT&#039;].$pdf_file;<br />
$save_to = $_SERVER[&#039;DOCUMENT_ROOT&#039;].$save_to;</p>
<p>echo $pdf_file;<br />
echo &quot;&#8221;;<br />
echo $save_to;<br />
echo &#8220;&#8221;;</p>
<p>$img = new imagick(&#8220;C:\Users\Windows01\Documents\GitHub\pdf-to-png\public\circles-01.pdf&#8221;);<br />
print_r ($img);</p>
<p>//this must be called before reading the image, otherwise has no effect &#8211; &#8220;-density {$x_resolution}x{$y_resolution}&#8221;<br />
//this is important to give good quality output, otherwise text might be unclear<br />
$img-&gt;setResolution(200,200);</p>
<p>//read the pdf<br />
$img-&gt;readImage(&#8220;{$pdf_file}[0]&#8221;);</p>
<p>//reduce the dimensions &#8211; scaling will lead to black color in transparent regions<br />
$img-&gt;scaleImage(800,0);</p>
<p>//set new format<br />
$img-&gt;setImageFormat(&#8216;jpg&#8217;);</p>
<p>// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions<br />
$img = $img-&gt;flattenImages();</p>
<p>//save image file<br />
$img-&gt;writeImages($save_to, false);</p>
<p>//echo the jpg image<br />
header(&#8220;Content-type: image/&#8221;.$img-&gt;getImageFormat());<br />
echo $img;	//same as echo $img-&gt;getImageBlob();</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mukesh		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-99794</link>

		<dc:creator><![CDATA[Mukesh]]></dc:creator>
		<pubDate>Tue, 06 Dec 2016 12:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-99794</guid>

					<description><![CDATA[Hi, 
   First of all Thanks for this nice work,
   i have one issue my one pdf convert to jpg but other is not can u please tell me what is the reason for this.]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
   First of all Thanks for this nice work,<br />
   i have one issue my one pdf convert to jpg but other is not can u please tell me what is the reason for this.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Karthik		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-89527</link>

		<dc:creator><![CDATA[Karthik]]></dc:creator>
		<pubDate>Sun, 24 Jul 2016 05:35:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-89527</guid>

					<description><![CDATA[Very useful post. 
Thanks]]></description>
			<content:encoded><![CDATA[<p>Very useful post.<br />
Thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: mohan		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-67247</link>

		<dc:creator><![CDATA[mohan]]></dc:creator>
		<pubDate>Wed, 23 Jul 2014 14:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-67247</guid>

					<description><![CDATA[I have following error 

Fatal error: Uncaught exception &#039;ImagickException&#039; with message &#039;Postscript delegate failed `D:/Xmapp/xampp/htdocs/test1/pdf.pdf&#039;: No such file or directory @ error/pdf.c/ReadPDFImage/645&#039; in D:Xmappxampphtdocstest1index.php:16 Stack trace: #0 D:Xmappxampphtdocstest1index.php(16): Imagick-&#062;__construct(&#039;D:/Xmapp/xampp/...&#039;) #1 {main} thrown in D:Xmappxampphtdocstest1index.php on line 16



Please help.]]></description>
			<content:encoded><![CDATA[<p>I have following error </p>
<p>Fatal error: Uncaught exception &#8216;ImagickException&#8217; with message &#8216;Postscript delegate failed `D:/Xmapp/xampp/htdocs/test1/pdf.pdf&#8217;: No such file or directory @ error/pdf.c/ReadPDFImage/645&#8242; in D:Xmappxampphtdocstest1index.php:16 Stack trace: #0 D:Xmappxampphtdocstest1index.php(16): Imagick-&gt;__construct(&#8216;D:/Xmapp/xampp/&#8230;&#8217;) #1 {main} thrown in D:Xmappxampphtdocstest1index.php on line 16</p>
<p>Please help.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Lss		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-65628</link>

		<dc:creator><![CDATA[Lss]]></dc:creator>
		<pubDate>Fri, 02 Aug 2013 16:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-65628</guid>

					<description><![CDATA[Use the following code to save the pdf page by page:

$pdf_file   = $_SERVER[&#039;DOCUMENT_ROOT&#039;].&#039;/201307301103041375192984.pdf&#039;;

 

$img = new imagick($_SERVER[&#039;DOCUMENT_ROOT&#039;].&#039;/201307301103041375192984.pdf&#039;);

 

//this must be called before reading the image, otherwise has no effect - &quot;-density {$x_resolution}x{$y_resolution}&quot;

//this is important to give good quality output, otherwise text might be unclear

$img-&#062;setResolution(200,200);

$number = $img-&#062;getnumberimages();

for($i=0;$ireadImage(&quot;{$pdf_file}[&quot;.$i.&quot;]&quot;);

    

$img-&#062;scaleImage(800,0);

 

//set new format

$img-&#062;setImageFormat(&#039;jpg&#039;);

 

// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions

$img = $img-&#062;flattenImages();

 

//save image file

$img-&#062;writeImages($_SERVER[&#039;DOCUMENT_ROOT&#039;].&#039;/demo(&#039;.$i.&#039;).jpg&#039;, false);    

}]]></description>
			<content:encoded><![CDATA[<p>Use the following code to save the pdf page by page:</p>
<p>$pdf_file   = $_SERVER[&#8216;DOCUMENT_ROOT&#8217;].&#8217;/201307301103041375192984.pdf&#8217;;</p>
<p>$img = new imagick($_SERVER[&#8216;DOCUMENT_ROOT&#8217;].&#8217;/201307301103041375192984.pdf&#8217;);</p>
<p>//this must be called before reading the image, otherwise has no effect &#8211; &#8220;-density {$x_resolution}x{$y_resolution}&#8221;</p>
<p>//this is important to give good quality output, otherwise text might be unclear</p>
<p>$img-&gt;setResolution(200,200);</p>
<p>$number = $img-&gt;getnumberimages();</p>
<p>for($i=0;$ireadImage(&#8220;{$pdf_file}[&#8220;.$i.&#8221;]&#8221;);</p>
<p>$img-&gt;scaleImage(800,0);</p>
<p>//set new format</p>
<p>$img-&gt;setImageFormat(&#8216;jpg&#8217;);</p>
<p>// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions</p>
<p>$img = $img-&gt;flattenImages();</p>
<p>//save image file</p>
<p>$img-&gt;writeImages($_SERVER[&#8216;DOCUMENT_ROOT&#8217;].&#8217;/demo(&#8216;.$i.&#8217;).jpg&#8217;, false);    </p>
<p>}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mahadeva Prasad		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-65380</link>

		<dc:creator><![CDATA[Mahadeva Prasad]]></dc:creator>
		<pubDate>Thu, 31 Jan 2013 10:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-65380</guid>

					<description><![CDATA[Great script helps a lot.....]]></description>
			<content:encoded><![CDATA[<p>Great script helps a lot&#8230;..</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sanat Kumar Panda		</title>
		<link>https://www.binarytides.com/convert-pdf-image-imagemagick-php/comment-page-1/#comment-65379</link>

		<dc:creator><![CDATA[Sanat Kumar Panda]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 14:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=3566#comment-65379</guid>

					<description><![CDATA[The above code is worked fine, but only I can view a single page.
I want to view multiple pages.
Please give me a solution for this.

Thanks in Advance.]]></description>
			<content:encoded><![CDATA[<p>The above code is worked fine, but only I can view a single page.<br />
I want to view multiple pages.<br />
Please give me a solution for this.</p>
<p>Thanks in Advance.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
