[OS X TeX] pdfinfo and calculating in an engine

Peter Dyballa Peter_Dyballa at Web.DE
Wed Mar 21 14:40:50 CET 2007


Am 21.03.2007 um 11:16 schrieb Friedrich Vosberg:

> Where can I find pdfinfo for using in a Shell script respectively  
> in an engine and how can I calculate in an engine?

It is part of xpdf.

There is workaround possible: grep -a ^/Count <file name.pdf> | sort  
+1 -n | tail -1 | awk '{print $NF}'


>
> 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:]]*//'

or better with " to save spaces in the file name

	pdfinfo "$WHOLE_PDF" | grep ^Pages | awk '{print $NF}'

or

	grep -a ^/Count "$WHOLE_PDF" | sort +1 -n | tail -1 | awk '{print $NF}'

>
> ... then it must calculate how much is the half of $WHOLE_PDF

In (ba)sh:

	half=`expr $Count / 2`
	rmdr=`expr $Count - $half`

In (t)csh:

	set half=`expr $Count / 2`
	set rmdr=`expr $Count - $half`


>
> ... 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?


Definitely not this way! The UNIX utilities lp or lpr cannot count  
PDF or PS pages. What they can count are lines in a(n ASCII) text  
document – and I am not sure whether they see too long lines!

The splitting of the PDF document has to be done with other means,  
from TeX, that generates the "samples."

--
Mit evolutionären Grüßen

   Pete


"Evolution"            o           __o                     _o _
           °\___o      /0~         -\<,              ^\___ /=\\_/-%
oo~_______ /\ /\______/ \_________O/ O_______________o===>-->O--o____



------------------------- 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 macostex-archives mailing list