Use a common portable pdf rescaling script.

This commit is contained in:
Peter D. Barnes, Jr.
2013-05-31 12:03:40 -07:00
parent 6eab23c955
commit 5cd2be069a
10 changed files with 34 additions and 76 deletions

View File

@@ -28,12 +28,14 @@ IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
IMAGES_TO_CLEAN = $(IMAGES_PNG_CONVERTED) $(IMAGES_PDF) $(IMAGES_EPS)
RESCALE = $(shell hg root)/utils/rescale-pdf.sh
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps;
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
# You can set these variables from the command line.

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}

View File

@@ -295,12 +295,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
RESCALE = $(shell hg root)/utils/rescale-pdf.sh
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
# You can set these variables from the command line.
SPHINXOPTS =

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}

View File

@@ -20,12 +20,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
RESCALE = $(shell hg root)/utils/rescale-pdf.sh
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
GRAPHS_PNG = ${GRAPHS_EPS:.eps=.png}
GRAPHS_PDF = ${GRAPHS_EPS:.eps=.pdf}
@@ -35,7 +37,7 @@ GRAPHS = $(GRAPHS_EPS) $(GRAPHS_PNG) $(GRAPHS_PDF)
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
# You can set these variables from the command line.
SPHINXOPTS =

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}

View File

@@ -20,12 +20,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
RESCALE = $(shell hg root)/utils/rescale-pdf.sh
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@;
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
GRAPHS_PNG = ${GRAPHS_EPS:.eps=.png}
GRAPHS_PDF = ${GRAPHS_EPS:.eps=.pdf}
@@ -35,7 +37,7 @@ GRAPHS = $(GRAPHS_EPS) $(GRAPHS_PNG) $(GRAPHS_PDF)
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
@if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi
# You can set these variables from the command line.
SPHINXOPTS =

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}

20
utils/rescale-pdf.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
TMPDIR=${TMPDIR:-/tmp}
TMPFILE=`mktemp -t $(basename ${2}).XXXXXX`
echo "Rescaling ${2} to ${1}"
echo "
\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}
" \
>${TMPFILE}.tex
pdflatex -output-directory ${TMPDIR} ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}