summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-23 23:09:23 +0000
committerKarl Berry <karl@freefriends.org>2017-09-23 23:09:23 +0000
commit4a1d317cb71ce63b9cf99e38f46c162ed027dd73 (patch)
tree17d891e1d5da71aee91089eef72a8e08e13f13f9 /Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh
parent4703727d234147fdadfd31af75329850476dde45 (diff)
pdfreview (23sep17)
git-svn-id: svn://tug.org/texlive/trunk@45391 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh')
-rwxr-xr-xMaster/texmf-dist/doc/latex/pdfreview/pdfreview.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh b/Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh
new file mode 100755
index 00000000000..a6818e4363b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pdfreview/pdfreview.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+# this script is part of the pdf-annotation LaTeX package by M. Palmer
+# like all files in the package, it is covered by the LPPL.
+
+# this assumes ghostscript is installed as 'gs - change as needed
+ghostscript="gs"
+
+script_name=`basename "$0"`
+
+if [ -z $1 ]; then
+ echo "Usage: $script_name inputfile.pdf > outputfile.tex"
+ exit 1
+fi
+
+source_doc=$1
+
+# doc_header will become the preamble of your wrapper document
+# edit it according it your preferences.
+
+doc_header="\documentclass[letterpaper,10pt]{article}
+
+\usepackage[
+ sourcedoc=$source_doc,
+ inline=true,
+ withnotesonly=false,
+ grid=true,
+ gridcolor=black!30,
+ trim={1cm 1cm 1cm 1cm},
+ bodywidth=0.75,
+ pageoffset=0,
+ fontsize=footnotesize,
+ twocolumn=false,
+ notesbg=yellow,
+ notesframe=black,
+ insertpagemargin=2.5cm
+]{pdfreview}
+
+\begin{document}
+"
+
+echo "$doc_header"
+
+# use ghostscript to obtain the page count from the pdf file
+page_count=$($ghostscript -q -dNODISPLAY -c "($source_doc) (r) file runpdfbegin pdfpagecount = quit")
+
+# write page environment for each of the pages
+for (( i=1; i<=$page_count; i++ ))
+do
+ echo "\begin{page}{$i}"
+ echo "\end{page}"
+ echo ""
+done
+
+echo "\end{document}"
+