diff --git a/keeplinks.sh b/keeplinks.sh new file mode 100644 index 0000000..2707fc4 --- /dev/null +++ b/keeplinks.sh @@ -0,0 +1,6 @@ +#!/bin/sh +sed -n ' +/%!/,/beginpage$/p +/\[ \/Rect/,/pdfmark/p +/^endpage/,/%%EOF/p +' diff --git a/makefile b/makefile index e2e0efb..efdab89 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ DOTFILES = $(basename $(wildcard *.dot)) -all: $(addsuffix .jpg, $(DOTFILES)) $(addsuffix .svg, $(DOTFILES)) +all: $(addsuffix .jpg, $(DOTFILES)) $(addsuffix .svg, $(DOTFILES)) $(addsuffix .pdf, $(DOTFILES)) %.jpg: %.dot dot "$<" -Tjpg -o "$@" @@ -8,4 +8,11 @@ all: $(addsuffix .jpg, $(DOTFILES)) $(addsuffix .svg, $(DOTFILES)) %.svg: %.dot dot "$<" -Tsvg -o "$@" +%.pdf: %.dot + dot "$<" -Tpdf -o main.pdf -Tps2 -o main.ps2 + sh keeplinks.sh < main.ps2 > link.ps2 + ps2pdf link.ps2 link.pdf + cpdf -stamp-on link.pdf main.pdf -o $@ + rm main.pdf main.ps2 link.ps2 link.pdf + clean: rm *.jpg *.svg