[How to] Automatically delete cover pages on downloaded PDFs

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

After a bit of puzzling around, I made a Hazel rule which will delete cover pages on downloaded PDFs files, with the help of the free PDFtk utility.

The key shell script is:
Code: Select all
path="$1"
name=$(basename "$path" ".pdf")
new_name="$name no cover page.pdf"
dir=$(dirname "$path")
pdftk "$1" cat 2-end output "$dir/$new_name"


Maybe this will help some people on this forum. I've gone into some more detail on how the script works, plus linked a mirrored PDFtk installer, in a blog post: http://cai.zone/2017/07/hazel-rule-to-delete-researchgate-pdf-cover-pages/
cai
 
Posts: 3
Joined: Thu Jul 13, 2017 3:07 pm

You might want to post this in the Tips forum instead. Or I could move this topic over there for you. Just let me know.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You might want to post this in the Tips forum instead. Or I could move this topic over there for you. Just let me know.


Oh, sorry, I didn't notice there were multiple forums! :oops: Yes, please do move it, thank you!
cai
 
Posts: 3
Joined: Thu Jul 13, 2017 3:07 pm

Here it is in its new home. Thanks for the post.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS

cron