Skip to content

Tag Archives: Ghostscript

Adding page numbers to PDFs on Linux

The follow Bash function takes an input PDF and adds page numbers in the lower right corner. numberpdf() { unset IFS OLD_IFS=$IFS && IFS=$’\n’ directory=$(pwd) outputFileName=”/$(basename “$1″ .pdf)”-with-page-numbers.pdf”" completeOutputFilePath=”$directory$outputFileName” remind “The output file is $completeOutputFilePath” gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=$completeOutputFilePath -c ‘globaldict /MyPageCount 1 put << /EndPage {exch pop 0 eq dup {/Helvetica 12 [...]

Double Sided Scan and PDF

The following script scans PDFs via an auto-document feeder in Hp-Lip and then collates the pages to the correct order when there are reverse sides. No scans will be saved if no data is transmitted for the second set of scans. The second set of scans is the reverse of the pages. #!/usr/bin/env bash YMD=$(date [...]