Add duplex PDF build targets with pdftk page interleaving
- Add pdftk-java to Docker image for PDF page manipulation - Extend generate_backside() to repeat back content num_pages times so front and back PDFs have matching page counts for pdftk shuffle - Add build-duplex and build-blanko-duplex Makefile targets that combine front and back PDFs with alternating pages (front1, back1, front2, back2) - Document duplex targets in README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,11 @@ TEX_FILE_BACK := brevetkarte-rueckseite.tex
|
||||
PDF_FILE_PERSONALIZED := brevetkarte-personalized.pdf
|
||||
PDF_FILE_BLANKO := brevetkarte-blanko.pdf
|
||||
PDF_FILE_BACK := brevetkarte-rueckseite.pdf
|
||||
PDF_FILE_DUPLEX := brevetkarte-duplex.pdf
|
||||
PDF_FILE_BLANKO_DUPLEX := brevetkarte-blanko-duplex.pdf
|
||||
CSV_FILE := export_brevetcard.csv
|
||||
|
||||
.PHONY: all build clean build-image build-back generate build-personalized build-blanko run shell help
|
||||
.PHONY: all build clean build-image build-back generate build-personalized build-blanko build-duplex build-blanko-duplex run shell help
|
||||
|
||||
# Default target
|
||||
all: build-personalized build-blanko
|
||||
@@ -75,6 +77,24 @@ build-blanko: build-image
|
||||
pdflatex -interaction=nonstopmode $(TEX_FILE_BACK)
|
||||
@echo "PDF generated: $(PDF_FILE_BACK)"
|
||||
|
||||
# Build duplex PDF (personalized front + back interleaved for duplex printing)
|
||||
build-duplex: build-personalized
|
||||
@echo "Combining front and back for duplex printing..."
|
||||
docker run --rm \
|
||||
-v $(PWD):/workspace \
|
||||
$(IMAGE_NAME) \
|
||||
pdftk A=$(PDF_FILE_PERSONALIZED) B=$(PDF_FILE_BACK) shuffle A B output $(PDF_FILE_DUPLEX)
|
||||
@echo "PDF generated: $(PDF_FILE_DUPLEX)"
|
||||
|
||||
# Build duplex PDF (blank front + back interleaved for duplex printing)
|
||||
build-blanko-duplex: build-blanko
|
||||
@echo "Combining blank front and back for duplex printing..."
|
||||
docker run --rm \
|
||||
-v $(PWD):/workspace \
|
||||
$(IMAGE_NAME) \
|
||||
pdftk A=$(PDF_FILE_BLANKO) B=$(PDF_FILE_BACK) shuffle A B output $(PDF_FILE_BLANKO_DUPLEX)
|
||||
@echo "PDF generated: $(PDF_FILE_BLANKO_DUPLEX)"
|
||||
|
||||
# Run container interactively
|
||||
run:
|
||||
docker run --rm -it \
|
||||
@@ -92,7 +112,7 @@ shell:
|
||||
# Clean generated files
|
||||
clean:
|
||||
@echo "Cleaning generated files..."
|
||||
rm -f *.aux *.log *.out *.toc *.pdf brevetkarte-personalized.tex brevetkarte-blanko.tex brevetkarte-rueckseite.tex
|
||||
rm -f *.aux *.log *.out *.toc *.pdf brevetkarte-personalized.tex brevetkarte-blanko.tex brevetkarte-rueckseite.tex $(PDF_FILE_DUPLEX) $(PDF_FILE_BLANKO_DUPLEX)
|
||||
|
||||
# Clean everything including Docker image
|
||||
clean-all: clean
|
||||
@@ -112,6 +132,8 @@ help:
|
||||
@echo " make generate - Generate tex files from CSV + event.yml"
|
||||
@echo " make build-personalized - Generate and compile front + back side PDFs"
|
||||
@echo " make build-blanko - Generate and compile blank card (no CSV needed)"
|
||||
@echo " make build-duplex - Build duplex PDF (front+back interleaved)"
|
||||
@echo " make build-blanko-duplex - Build blank duplex PDF"
|
||||
@echo " make build-back - Compile back side PDF only (after generate)"
|
||||
@echo " make shell - Open interactive shell in container"
|
||||
@echo " make clean - Remove generated files (aux, log, pdf)"
|
||||
|
||||
Reference in New Issue
Block a user