Anyone know of a way using php (no shell_execs), to convert a pdf to an image type of
png, jpg,gif, or tif?
In my existing app we are shelling out using ghostscript, pdftk, etc, and would like to
switch this over to all inside of php.
Yes, I've googled. a lot! ;)
it looks like fpdf will allow you to convert an image of those types, but can't see how to
load an existing pdf and then to convert it.
0
image (/tags/image) php (/tags/php) re-load (/tags/re-load)
Grow your professional network with Dazah's matching algorithm Meet Your Matches
6 6 38 8 Years 2 Years Ago
(/programming/web-
Contributors Replies Views Discussion Span
development/threads/
207409/php-pdf-
converting-to-png-jpg-
gif-tif#post2189557)
Last Post by diafol
1. <?php
2. try
3. {
4. // Saving every page of a TIFF separately as a JPG thumbnail
5. $images = new Imagick("testing.tif");
6. foreach($images as $i=>$image) {
7. // Providing 0 forces thumbnail Image to maintain aspect ratio
8. $image‐>thumbnailImage(768,0);
9. $image‐>writeImage("page".$i.".jpg");
10. echo "<img src='page$i.jpg' alt='images' ></img>";
11. }
12. $images‐>clear();
13. }
14. catch(Exception $e)
15.
16.
{
echo $e‐>getMessage();
1 17. }
18. ?>
(/members/416137/chrishea) chrishea 182 (/members/416137/chrishea)
I don't see how that will help since it is intended to convert Tiff to JPG/GIF not PDF to
JPG/GIF.
This might help
0 http://forums.digitalpoint.com/showthread.php?t=230074
(http://forums.digitalpoint.com/showthread.php?t=230074)
Just replace testing.tif with your pdf file. It will work fine. You need to install
ImageMagick and ghostscript for this to work.
Following is further simpler example of pdf to jpg.
1. $im = new imagick($file_location); // your pdf file
0 2. $im‐>setImageFormat( "jpg" );
3. $pdf_pages=$im‐>getNumberImages();
(/members/1107958/ghanshyam-1) Ghanshyam_1 (/members/1107958/ghanshyam-1)
…
4 Years Ago (https://www.daniweb.com/programming/web-development/threads/207409/php-pdf-co…
Thank you so much I have done with pdf to png images generate.
0 Again thank! You save me from the pain.
(/members/1127720/adeleb) AdeleB (/members/1127720/adeleb)
diafol
The OP was 6 years ago. Please refrain from resurrecting this dead thread. The last post
is specific to .NET technologies. The OP, although not specified, but stated in the tags,
points to PHP. If anybody has a specific useful link / custom solution for this that
0 improves upon information already given in this thread, fine. Else, please leave alone.
Thanks.
This topic has been dead for over six months. Start a new discussion instead.
(/programming/web-development/6/contribute)
Preview (/welcome/syntax)
Post your Reply
(https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.daniweb.com%2Fprogramming%2Fweb-development%2Fthreads%2F207409%2Fphp-pdf-converting-to-pn
(https://twitter.com/intent/tweet?text=php+pdf+-+converting+to+png%2Fjpg%2Fgif%2Ftif&via=daniweb&url=https%3A%2F%2Fwww.daniweb.com%2Fprogramm
(https://plus.google.com/share?url=https%3A%2F%2Fwww.daniweb.com%2Fprogramming%2Fweb-development%2Fthreads%2F207409%2
(https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.daniweb.com%2Fprogramming%2Fweb-de
(/rss/6)
Recommended Topics
Recently I'm trying to pass text boxes , radio buttons and checkboxes vaues to database.
For that for the clear understanding I'll provide simple way of form.
1. <form method="post">
2. <input ...
Changing sentence into indirect (/programming/threads/516569/changing-sentence-into-
indirect)
Last Post 2 Days Ago
Suppose I have a text file :
As a manager, he told FIFA TV he communicates his messages in a measured way.
“I’m not one of the lads,” Southgate ...
How do i make a menu click down button? (/programming/web-
development/threads/516462/how-do-i-make-a-menu-click-down-button)
Last Post 2 Days Ago
Here is the code i have for a website. I just need the menu to be a click down and it's not
working.