Link to home
Start Free TrialLog in
Avatar of rjef
rjefFlag for United States of America

asked on

convert PDF to JPEG command line utility

i need a utility that i can run from a command line that will 'convert PDF to JPEG command line utility'
Avatar of ITguy565
ITguy565
Flag of United States of America image

Hopefully this helps:

http://www.e-pdfconverter.com/blog/how-to-convert-pdf-to-imagejpgbmptifgif-with-command-line/

e-PDF to Image Converter is a program based on Windows platform, which allows the batch converting of large numbers of PDF files at the same time. e-PDF to Image Converter can be integrated into your own software applications or Web-server applications to convert PDF files to image files (JPG, JPEG, TIFF, BMP, PNG, GIF, TGA, PCX, PNM, RAS, PBM, etc.)
Try this

http://www.coolutils.com/Convert-PDF-JPEG-cmd

CoolUtils offers a highly efficient solution for exporting PDF files to image format – convert PDF to JPEG command line utility that is capable of both single and batch conversions with fully adjustable parameters. It is Total PDF Converter X, working on Windows server and available for in-building into any client-server application. It is an ideal solution for local networks or online services where PDF to JPEG conversion is must-have feature.
Avatar of rjef

ASKER

i would like a free one.
SOLUTION
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
IrfanView is excellent (free!) imaging software that I've been using for many years:
http://www.irfanview.com/

Click the Download link on the left to download IrfanView and click the PlugIns link on the left to download the PlugIns, which are needed to give you PDF capability. Install IrfanView first, then install the PlugIns.

The command line to do what you want is this:

i_view32.exe input_file.pdf /convert=output_file.jpg

That's it! Of course, you'll need the path for i_view32.exe (such as c:\Program Files (x86)\IrfanView) and the path for your input and output files. There are also options, such as JPG quality (/jpgq), which is in the range 1-100. For example:

i_view32.exe input_file.pdf /convert=output_file.jpg /jpgq=75

I have attached a PDF for you with all of the command line options in the latest version (4.36).

Btw, if it's a multi-page PDF, it will convert just the first page to a JPG (with the same file name as the PDF and a file extension of JPG).

IrfanView is an extraordinary piece of FREE software! It also has a great GUI interface. Both the command line and GUI work extremely well. Regards, Joe
IrfanView-4.36-command-line-opti.pdf
Avatar of rjef

ASKER

"C:\Program Files (x86)\IrfanView\i_view32.exe" C:\Fuj Canban\can.pdf /convert=cancan.jpg
it says error can not load c:\fuj can.pdf
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that your input file name is:

C:\Fuj Canban\can.pdf

but IrfanView is saying it can't find:

c:\fuj can.pdf

Btw, I get the same message when specifying a file that doesn't exist:
User generated imageWhen the PDF file exists, IrfanView converts it perfectly to JPG. Regards, Joe
Avatar of rjef

ASKER

what if the pdf is more than 1 page?
Here's the comment that was in my first post:

Btw, if it's a multi-page PDF, it will convert just the first page to a JPG (with the same file name as the PDF and a file extension of JPG).
That said, it's doable, but you'll need another (free) product, the PDF Toolkit (PDFtk):
http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

The command line (pdftk.exe) has an option called "burst" that splits a multi-page PDF into into individual pages, which can named with a printf-styled format string (default is pg_%04d.pdf, e.g., pg_0001.pdf, pg_0002.pdf, etc.).

Then run IrfanView's convert-to-JPG on the one-page files created with the "burst" option by PDFtk. This is relatively easy to do with any programming/scripting language that can call command line executables (a simple loop will do it). Regards, Joe
Avatar of rjef

ASKER

joe one last question than i will give you the points.  I tried using irfanview to crop a pdf.  it cropped it but the pdf i am cropping has barcodes in it and when i try to print the cropped file the barcodes are not readable by the scanner.  any idea what could be causing this?
After cropping the PDF, are you converting to JPG? If so, make sure the JPG quality is set to 100. At lower quality, it may produce fuzzy/pixelated barcodes that the scanner can't read.

Similar issue if you're saving it as a PDF after cropping. It may be that the compression setting is causing a large enough reduction in quality so that the scanner can't read the barcode. Here's what the PDF Settings dialog (GUI) looks like when you Save As to a PDF:
User generated imageNote the different compression settings for Color, Grayscale, and Monochrome (black&white). Experiment with different compression techniques and even try no compression (un-check the Activate Compression box). I'm not sure how this translates into the command line call, but just to troubleshoot the barcode/scanner issue, try it in the GUI. Regards, Joe
Avatar of rjef

ASKER

i will try this.  just fyi   when i just open the pdf in irfanview and print it i can not scan the barcodes from the printed pdf
> when i just open the pdf in irfanview and print it i can not scan the barcodes from the printed pdf

OK, then cropping/converting is not the problem. It's probably the low DPI Postscript settings for the GhostScript plugin. Try this:

Options
Properties/Settings
PlugIns

Look in the Other PlugIns section and click the [Postscript options] button. The DPI is probably set to 96x96. Change it to 300x300. Also, the [Enable Antialiasing] box should be checked (it probably is, but if not, check it). Let me know if this helps.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial