How to create pagination in PHP?

Create Image from PDF using PHP

  • Hello, I need to create an image FROM a PDF file using PHP or Perl (or other common server-side scripting language). Consider this example: I have a one-page PDF file, and I have a user who (for one reason or another) cannot install Adobe Acrobat Reader. Thus, I want the user to be able to view the PDF as an image (gif, jpg, or png), but I want to be able to do this programmatically - i.e., I don't want to have to take a screen shot and upload the image myself. You may assume that I have access to many of the most common PHP multimedia libraries, like PDFLib, ImageMagick, and GD, and that PHP or Perl modules can be installed if needed. Although not currently installed on the server, I could probably also use Java/Servlet technology if there is no way to do this in PHP or Perl. How would I accomplish this? Thanks, Darren

  • Answer:

    Darren, To do what you want to do, you need GhostScript and ImageMagick installed. Your script (in PHP, Perl, or whichever) can then call ImageMagick's "convert" program, and make the conversion. convert sample.pdf sample.jpeg -or- convert sample.pdf sample.png So, to make the conversion in PHP, just do: exec("convert sample.pdf sample.jpeg") You might also find this helpful: http://www.samurajdata.se/~cj/ps.html More information: http://www.php.net/manual/en/function.exec.php http://www.imagemagick.org/www/formats.html Search Stragegy: "php pdf" on google.com -- samrolken-ga

g8z-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.