• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
COnvert PDF file to JPG file

Hello all,

I am trying to convert pdf file to jpg file at the time of file upload.
can anyone help me for this that how i can do...

Thanks in advance

There is like 1000000000 guides when you enter 'php pdf to jpg' in google... Use it, wont hurt

Hello noideawhattotypehere

I already serched in google and there is also an imagick library which do this better.
But my problem is that how can i use imagick in my project, i don't understand it. so, if there is some example that previously used by anyone then it should help me.

and thanks for your response, but always firstly i search in google and after that in this blog.


The image library supports ImageMagick if you have it installed on your server: http://ellislab.com/codeigniter/user-gui...e_lib.html

$config = array(
    'image_library' => 'imagemagick',
    'library_path' => 'imagemagick_file_path_goes_here',
    'source_image' => $pdf_path,
    'new_image' => $img_path,
    'maintain_ratio' => true,
    'width' => 365,
    'quality' => '100%',

   $this->image_lib->initialize( $config );

   if ( $this->image_lib->resize( ) ) {
    $this->image_lib->clear( );

Hello PM jonez

Thanks for the reply and the link.

But there is doubt i.e. where i am write the code?? in controller?? and in module i write the code for dtaabase inset?? is it the correct process??

Kindly reply for this...i am now just coded in normal mvc and learning about codeigniter mvc.


You can put it anywhere. The code I pasted was used in a library since multiple controllers call it. If you don't need the code shared between controllers you can put it in the one controller you need. Or if the thumbnail is part of a single object action you could put it in the model.

Hello jonez

Thank you for the reply. I am trying to implement it.

I used to convert PDF file to JPG image on my work with this PDF converter, works fairly well, hope it helps you.
Contact me if you have any other question.

If you want to convert pdfs to jpeg you are best advised to use online services such as: pdfjpg.net. Simple upload your pdfs and download your newly converted jpegs.
Hope this helps Baki1492

google does help Tongue
there are literally millions of sites that will do this, quick and easy
if you want more options such as page selection and rotation, http://online-pdf.org/ isnt too bad
if you dont trust any online sites, you can just use adobe's program Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.