Created
November 23, 2023 05:45
-
-
Save antedeguemon/2e4d0808b09ba0c7a7e2e702eb5ab532 to your computer and use it in GitHub Desktop.
pdfbook2 in MacOS using docker
This file contains 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
FROM debian:bullseye | |
RUN apt-get update && \ | |
apt-get -y install texlive-extra-utils | |
WORKDIR /data |
This file contains 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
#!/bin/bash | |
PAPER="a4paper" | |
OUTER_MARGIN="20" | |
INNER_MARGIN="30" | |
CONTAINER_NAME="pdfbook2-debian" | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: $0 <file> [pdfbook2 options...]" | |
exit 1 | |
fi | |
FILE="$1" | |
shift | |
OPTIONS="$@" | |
docker build -t $CONTAINER_NAME . | |
cp "$FILE" input.pdf | |
docker run --rm -v "$(pwd):/data" $CONTAINER_NAME pdfbook2 --inner-margin="$INNER_MARGIN" --outer-margin="$OUTER_MARGIN" --paper="$PAPER" $OPTIONS "/data/input.pdf" | |
echo "Output saved to input-book.pdf" | |
rm -rf input.pdf | |
open input-book.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment