Sunday, March 23, 2014

PS to PDF: convert and crop

I've done this task once before and forgot how. It took me a while to do it again, so I'm posting this here in case somebody else needs it. It might not be the best way to do it so if you can make it better, I'd love to hear from you.

I'm using pstill_dist and pdfcrop with two subdirectories for all input and output files.
#!/bin/bash
for FILE in $(find ./input -name '*.ps'); do
    FNAME="${FILE##*/}"
    FNAME="${FNAME%.*}"
    ./pstill "./input/${FNAME}.ps" -o "./output/${FNAME}.pdf"
    pdfcrop --clip "./output/${FNAME}.pdf" "./output/${FNAME}.pdf"
done

No comments: