Solved

Auto create images from PDF

Posted on 2014-02-05
9
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 35

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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 35

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 110

Expert Comment

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add a date range function to PDF Generation 9 40
PHP substring 3 50
e commerce steps shown instead of self testing 2 55
Google Recaptcha 13 51
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

737 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