Basicly
pdf2ps -> pstopnm (and resize) -> convert (to jpg)
#!/bin/bash
# This is a test to see if or how I can create a watermark for an OpenOffice document from a PDF file.
FILE_NAME="testfile"
THE_PDF_FILE="$FILE_NAME.pdf"
THE_JPG_FILE="$FILE_NAME.jpg"
THE_PS_FILE="$FILE_NAME.ps"
# The PPM files get numbered for each page. My test PDF has two pages.
THE_PPM_FILE="$FILE_NAME""001.ppm"
pdf2ps $THE_PDF_FILE
# I cheeted. I did all this before but without the xsize and ysize and found that the
# file came out to be 596 by 788 but that was very poor quality to I am resizing to
# get a better image.
X_SIZE=596
Y_SIZE=788
# I seem to get a really good quality image from 4x zoom. It will go higher but my
# test PDF did not get any better then that.
QUALITY=4
NEW_X_SIZE=`expr $X_SIZE \* $QUALITY`
NEW_Y_SIZE=`expr $Y_SIZE \* $QUALITY`
pstopnm -xsize $NEW_X_SIZE -ysize $NEW_Y_SIZE $THE_PS_FILE
rm $THE_PS_FILE
convert $THE_PPM_FILE $THE_JPG_FILE
rm $THE_PS_FILE
rm $THE_PPM_FILE
|
signature.asc
Description: This is a digitally signed message part
