Skip to content

Instantly share code, notes, and snippets.

@LordAmit
Last active February 20, 2022 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LordAmit/1442c603735e7c466ce671b66cce0ac0 to your computer and use it in GitHub Desktop.
Save LordAmit/1442c603735e7c466ce671b66cce0ac0 to your computer and use it in GitHub Desktop.
Adding Right Margin to PDF for Writing Notes or Annotations
#!/bin/sh
## DISCLAIMERS
## 1. This script is not intended to be used as is. It is more like a set of instructions; by no means you are supposed to execute it exactly like this every.single.time.
## 2. Credit for mentioning pdf-crop-margins goes to https://unix.stackexchange.com/a/638371
# go to your desired directory
cd ~/git/pdfcropmargin
# create a venv
python3 -m venv venv
# activate venv
source venv/bin/activate
# install pdfcropmargin
pip install pdfcropmargins
## use it like so
## -p 100 is REQUIRED to maintain original margin for top, left, bottom; while -100 adds 100 margin to the right side.
## Since it is a margin cropper, negative = add margin.
pdf-crop-margins -o out.pdf -p 100 -a4 0 0 -100 0 in.pdf
## when done, deactivate, maybe.
deactivate
## some other things you can do for setup
echo "$PWD/venv/bin/pdf-crop-margins -o \$1_out.pdf -p 100 -a4 0 0 -100 0 \$1" > script.sh
chmod +x script.sh
echo "alias pdfcropmargin=$PWD/script.sh" >> ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment