Skip to content

Commit

Permalink
Use a common portable pdf rescaling script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter D. Barnes, Jr. committed May 31, 2013
1 parent 6eab23c commit 5cd2be0
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 76 deletions.
4 changes: 3 additions & 1 deletion doc/manual/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 0 additions & 14 deletions doc/manual/rescale-pdf.sh

This file was deleted.

4 changes: 3 additions & 1 deletion doc/models/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
14 changes: 0 additions & 14 deletions doc/models/rescale-pdf.sh

This file was deleted.

6 changes: 4 additions & 2 deletions src/antenna/doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 =
Expand Down
14 changes: 0 additions & 14 deletions src/antenna/doc/rescale-pdf.sh

This file was deleted.

6 changes: 4 additions & 2 deletions src/buildings/doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 =
Expand Down
14 changes: 0 additions & 14 deletions src/buildings/doc/rescale-pdf.sh

This file was deleted.

14 changes: 0 additions & 14 deletions src/lte/doc/rescale-pdf.sh

This file was deleted.

20 changes: 20 additions & 0 deletions utils/rescale-pdf.sh
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit 5cd2be0

Please sign in to comment.