[OS X TeX] pdfinfo and calculating in an engine
Bernd Web
bernd.web at gmail.com
Wed Mar 21 07:16:05 EDT 2007
On 3/21/07, Friedrich Vosberg <fvosberg at mac.com> wrote:
> Morning.
>
> Where can I find pdfinfo for using in a Shell script respectively in
> an engine and how can I calculate in an engine?
>
> The idea is to create a PDF file that includes another PDF twice: One
> without background picture (original), one with COPY (copy) in the
> background. Then it should be printed the »original« in simplex mode
> (one page one sheet) and the »copy« in duplex mode (one sheet two
> pages). Therefore its necessary to check how many pages a PDF file
> contains ...
>
> pdfinfo $WHOLE_PDF | grep ^Pages | sed 's/Pages:[[:space:]]*//'
>
> ... then it must calculate how much is the half of $WHOLE_PDF
>
> ???
half=`expr $pages / 2`
> ... and then print via ...
>
> lp -P $FIRST_HALF -t engineprintout.pdf "${basefname}.pdf"
>
> ... the first half of them simplex and via ...
>
> lp -P $SECONF_HALF -t engineprintout.pdf -o sides=two-sided-long-
> edge "${basefname}.pdf"
>
> ... the second half in duplex mode.
>
> How can I realize this?
>
> TIA and kind regards, Friedrich
Hi Friedrich,
I am not sure what the input is and where the problem actually is.
Assuming you have the PDF and your lp commands are correct, you could
probably do something like this in bash:
basefname=$1 #argument 1 on commandline
#i do not have pdfinfo
#pages=`pdfinfo $WHOLE_PDF | grep ^Pages | sed 's/Pages:[[:space:]]*//'`
pages=6
half=`expr $pages / 2`
FIRST_HALF="1-$half"
half=`expr $half + 1`
SECOND_HALF="$half-$pages"
`lp -P $FIRST_HALF -t engineprintout.pdf "${basefname}.pdf"`
`lp -P $SECOND_HALF -t engineprintout.pdf -o sides=two-sided-long-edge
"${basefname}.pdf"`
calling this script with argument "mypdf" will execute:
lp -P 1-3 -t engineprintout.pdf mypdf.pdf
lp -P 4-6 -t engineprintout.pdf -o sides=two-sided-long-edge mypdf.pdf
Note that "expr" returns integers, so: 5/2 = 2
regards,
bernd
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the MacOSX-TeX
mailing list