Last active
March 1, 2024 13:00
-
-
Save hylophile/7f419be7ba87ece018b4c85452010560 to your computer and use it in GitHub Desktop.
annotate every page of some pdf files with some text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| pdf_dir="lec" | |
| mkdir -p lec_out/lec | |
| for file in "$pdf_dir"/*.pdf; do | |
| filename=$(basename -- "$file") | |
| filename_no_ext="${filename#lec_}" | |
| filename_no_ext="${filename%.*}" | |
| echo "$filename_no_ext" > filename.txt | |
| echo pandoc "$filename_no_ext" | |
| pandoc --pdf-engine=lualatex \ | |
| -V mainfont="DejaVu Sans" \ | |
| -V pagestyle=empty \ | |
| -V documentclass=scrartcl \ | |
| -V fontsize="20pt" \ | |
| -V geometry:margin=1cm \ | |
| filename.txt \ | |
| -o filename.pdf | |
| echo pdftk lec_out/"$file" | |
| pdftk "$file" stamp filename.pdf output lec_out/"$file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment