Solved

Auto create images from PDF

Posted on 2014-02-05
9
258 Views
Last Modified: 2014-03-23
I wounder if it is possible to..........

1. Auto create an image (gif format) from PDF files. (all the PDF files have just one page).

2. The conversion should start from an y point and end at y point (omit the header and footer).

3. Resize the the converted image to a fix given width and height.

I would be so happy to know this process can be done via php/jquery or anything else...
0
Comment
Question by:Refael
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 200 total points
ID: 39836709
Do you have shell access as you will need to install a couple of things
http://www.webvamp.co.uk/blog/coding/how-to-create-pdf-preview-images-in-php/

While this only creates a full page image you could then crop so many pixels from the top and bottom.
There is no point digressing to the other questions unless you can get imagemagick and ghostscript installed.
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39836722
You can do 1 and 3 with php (or the scripting language of your choice) and ImageMagick.

I don't think you can do 2 on the same step as 1, but once you have your gif you can crop it using ImageMagick.

So yes, all the steps can be done using php and the ImageMagick library.

HTH,
Dan
0
 

Author Comment

by:Refael
ID: 39836751
Hi Cathal, Dan Craciun

I have only the access to the FTP. Not sure i can get an access to the hosting for the shell.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 58

Expert Comment

by:Gary
ID: 39836772
If your host will not install them then you are out of luck, as its shared hosting they are unlikely to install anything but you can ask them. They may already have them on the server, imagemagick is common and it wouldn't be unusual to see it.
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39836819
Or, if it's a one time job, just download all your pdf's to your computer and use XAMPP/WAMP (I assume you use Windows) to use php locally.
0
 

Author Comment

by:Refael
ID: 39836860
Oh... yes i can do it locally. i can download via FTP all the PDF files for each project then run the script locally on my mac. Can this script do all the steps (1-3)?. What should i download and how to run it? Can you please guide me?
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39836962
Are you on Windows Hosting?
0
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 300 total points
ID: 39837026
If you can work locally on your mac you don't need php.

Install imagemagick as noted here: http://www.imagemagick.org/script/binary-releases.php#macosx

Install ghostscript either via brew or from here: http://pages.uoregon.edu/koch/
Ghostscript is needed to convert from pdf.

Then:
1: convert -density 100 -depth 8 xxx.pdf xxx.gif
2: convert xxx.gif -shave 0,<no of px> xxx_noheaders.gif
3. convert xxx_noheaders.gif -resize <no of px> xxx_small.gif

HTH,
Dan
0
 

Author Comment

by:Refael
ID: 39948937
Hi Guys,
Thank you for your solutions. This is not a one time job. I need to do the the same for almost every project i get. Anyway i decided to continue doing it manually as i am not sure about the installation and the how-to's... and again i thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Security 29 49
Is there a way to bind the ID to the text value of the search result? 28 53
check mysql insert 12 28
Php logic to add to date card 9 23
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question