#linux #pdf

Converting pdf files under Linux.

  1. Convert pdf file to image – PNG
convert FILENAME.pdf FILENAME.png
  1. Convert pdf file to image – JPG
convert FILENAME.pdf FILENAME.jpg
#More advanced example:
convert -quality 100 -density 600x600 FILENAME.pdf FILENAME%d.jpg
#the above will produce a FILENAME0.jpg, FILENAME1.jpg etc...

2a. Convert a directory of pdf files to images:

for i in *.pdf ; do  convert "${i}"  "${i}.jpg"; done;
  1. Convert pdf file to a html page
pdftohtml FILENAME.pdf
pdf2html FILENAME.pdf
  1. Extract images from a pdf file using pdfimages
#list image files in pdf:
pdfimages FILENAME.pdf -list
#export images
#the above will produce JPEG files 
#with names starting IMAGE_NAME_PREFIX