Files
BlackboxBook/build_pdf_ebook.command
2026-05-20 20:55:03 +03:00

42 lines
804 B
Bash
Executable File

#!/bin/bash
set -u
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PDF_PATH="$SCRIPT_DIR/BlackboxBook_ebook.pdf"
cd "$SCRIPT_DIR" || exit 1
printf "Building ebook PDF...\n\n"
if ! command -v python3 >/dev/null 2>&1; then
printf "python3 was not found in PATH.\n\n"
printf "Press Enter to close..."
read -r _
exit 1
fi
python3 "$SCRIPT_DIR/scripts/build_book_pdf.py" \
--source "$SCRIPT_DIR/book" \
--output "$PDF_PATH" \
--layout-profile ebook \
--page-width 6in \
--page-height 8in \
--margin 0.35in \
--wrap-code-blocks \
--code-font-size footnotesize
STATUS=$?
printf "\n"
if [ "$STATUS" -eq 0 ]; then
printf "ebook PDF created: %s\n" "$PDF_PATH"
else
printf "Build failed with exit code %s\n" "$STATUS"
fi
printf "\nPress Enter to close..."
read -r _
exit "$STATUS"