Browse Source

initial commit 💥

pull/1/head
Nemo 2 years ago
commit
09c2308188
  1. 3
      .gitignore
  2. 41
      generate.sh
  3. 21
      urls.txt

3
.gitignore

@ -0,0 +1,3 @@
SE*.pdf
security-engineering-3rd-edition.pdf
temp.pdf

41
generate.sh

@ -0,0 +1,41 @@
#!/bin/bash
COVER_URL=https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-cover.jpg
wget --timestamping "$COVER_URL" --output-document cover.jpg
convert cover.jpg cover.pdf
wget --timestamping --input-file "urls.txt"
pdftk cover.pdf SEv3-pref-May16.pdf SEv3-ch1-dec18.pdf \
SEv3-ch2-dec18.pdf SEv3-ch3-dec18.pdf SEv3-ch4-dec18.pdf \
SEv3-ch5-dec18.pdf SEv3-ch6-dec18.pdf SEv3-ch7-dec18.pdf \
SEv3-ch8-dec18.pdf SEv3-ch9-dec18.pdf SEv3-ch10-dec18.pdf \
SEv3-ch11-jan7.pdf SEv3-ch13-dec18.pdf SEv3-ch14-dec20.pdf \
SEv3-ch15-dec18.pdf SEv3-ch16-dec18.pdf SEv3-ch17-dec20.pdf \
SEv3-ch18-dec18.pdf SEv3-ch19-dec18.pdf SEv3-ch26-dec18.pdf \
SEv3-bib-jan7.pdf cat output temp.pdf
PAGE_NUM=2
echo "BookmarkBegin" > meta.txt
echo "BookmarkTitle: Cover" >> meta.txt
echo "BookmarkLevel: 1" >> meta.txt
echo "BookmarkPageNumber: 1" >> meta.txt
input="urls.txt"
while IFS= read -r line
do
FILENAME=$(basename "$line")
PAGES=$(qpdf --show-npages "$FILENAME")
echo "BookmarkBegin" >> meta.txt
echo "BookmarkTitle: $FILENAME" >> meta.txt
echo "BookmarkLevel: 1" >> meta.txt
echo "BookmarkPageNumber: $PAGE_NUM" >> meta.txt
PAGE_NUM=$((PAGE_NUM+PAGES))
echo "Current page is $PAGE_NUM"
done < "$input"
pdftk temp.pdf update_info meta.txt output security-engineering-3rd-edition.pdf
rm temp.pdf

21
urls.txt

@ -0,0 +1,21 @@
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-pref-May16.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch1-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch2-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch3-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch4-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch5-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch6-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch7-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch8-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch9-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch10-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch11-jan7.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch13-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch14-dec20.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch15-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch16-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch17-dec20.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch18-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch19-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-ch26-dec18.pdf
https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-bib-jan7.pdf
Loading…
Cancel
Save