I have a Ghostscript to split PDF books in 50 pages interval. The problem is the GS is removing the transparency (I think this is called alpha channel in technical terms: http://www.peteryu.ca/tutorials/publishing/pdf_manipulation_tips) of the annotations. Look at the following paragraph from a book. The highlight was fully readable before the splitting.
Now, it is blacked out.
So, I am looking for a way to do the splitting using other tools like PDFtk or any other tool which will not flatten my annotations.
Ultimately, I want to run the script on a folder of files using Hazel in Mac.
Here is the Ghostscript if it helps: ($1 is Hazel's way of importing the file, I think).
echo "Page count: "
ournum=`gs -q -dNODISPLAY -c "("$1") (r) file runpdfbegin pdfpagecount = quit" 2>/dev/null`
declare -i counter;
declare -i counterplus;
counter=1;
while [ $counter -le $ournum ] ; do
echo $counter
newname=`echo $1 | sed -e s/\.pdf//g`
reallynewname=$newname-$counter.pdf
counterplus=$counter+50;
yes | gs -dBATCH -sOutputFile=$reallynewname -dFirstPage=$counter - dLastPage=$counterplus -sDEVICE=pdfwrite "$1" >& /dev/null
counter=$counterplus
done;
Can you guys help me with this?
Thanks