Solved

Auto create images from PDF

Posted on 2014-02-05
9
254 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 58

Expert Comment

by:Gary
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 34

Expert Comment

by:Dan Craciun
Comment Utility
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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
Are you on Windows Hosting?
0
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 300 total points
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now