Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A good library for converting PDF to TIFF? [closed]

Tags:

java

pdf

tiff

I need a Java library to convert PDFs to TIFF images. The PDFs are faxes, and I will be converting to TIFF so that I can then do barcode recognition on the image. Can anyone recommend a good free open source library for conversion from PDF to TIFF?

like image 428
D'Arcy Rittich Avatar asked Dec 10 '08 15:12

D'Arcy Rittich


1 Answers

I can't recommend any code library, but it's easy to use GhostScript to convert PDF into bitmap formats. I've personally used the script below (which also uses the netpbm utilties) to convert the first page of a PDF into a JPEG thumbnail:

#!/bin/sh

/opt/local/bin/gs -q -dLastPage=1 -dNOPAUSE -dBATCH -dSAFER -r300 \
    -sDEVICE=pnmraw -sOutputFile=- $* |
    pnmcrop |
    pnmscale -width 240 |
    cjpeg

You can use -sDEVICE=tiff... to get direct TIFF output in various TIFF sub-formats from GhostScript.

like image 151
Alnitak Avatar answered Nov 13 '22 13:11

Alnitak