Skip to content

Instantly share code, notes, and snippets.

@antedeguemon
Created November 23, 2023 05:45
Show Gist options
  • Save antedeguemon/2e4d0808b09ba0c7a7e2e702eb5ab532 to your computer and use it in GitHub Desktop.
Save antedeguemon/2e4d0808b09ba0c7a7e2e702eb5ab532 to your computer and use it in GitHub Desktop.
pdfbook2 in MacOS using docker
FROM debian:bullseye
RUN apt-get update && \
apt-get -y install texlive-extra-utils
WORKDIR /data
#!/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