summaryrefslogtreecommitdiff
path: root/tex/context/base/spec-tpd.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/spec-tpd.tex')
-rw-r--r--tex/context/base/spec-tpd.tex1322
1 files changed, 670 insertions, 652 deletions
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 810ad97da..bab5561ee 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -1,652 +1,670 @@
-%D \module
-%D [ file=spec-tpd,
-%D version=1996.01.25,
-%D title=\CONTEXT\ Special Macros,
-%D subtitle=\PDFTEX,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. Non||commercial use is
-%C granted.
-
-%D Being one of the first typographical systems able to support
-%D advances \PDF\ support, \TEX\ is also one of the first
-%D systems to produce high quality \PDF\ code directly. Thanks
-%D to Han The Thanh c.s. the \TEX\ community can leap forward
-%D once again.
-%D
-%D One important characteristic of \PDFTEX\ is that is can
-%D produce standard \DVI\ code as well as \PDF\ code. This
-%D enables us to use one format file to support both output
-%D formats.
-%D
-%D All modules in this group use specials to tell drivers what
-%D non||\TEX\ actions to take. Because from the \TEX\ point of
-%D view, there is no difference between \DVI\ and \PDF, we
-%D therefore only have to bend the \DVI\ driver support into
-%D \PDF\ support. Technically spoken, specials no longer serve
-%D a purpose, except from ending up as comment in the \PDF\
-%D file. The core primitive in this module therefore is the
-%D \PDFTEX\ primitive \type{\pdfliteral}.
-%D
-%D Before we continue we need to make sure if indeed those
-%D \PDFTEX\ primitives are permitted. If no primitives are
-%D available, we just stop reading any further.
-
-\ifx\pdftexversion\undefined \endinput \else \unprotect \fi
-
-%D Once we are sure that we're indeed supporting \PDFTEX, we
-%D force \PDF\ output at the highest compression. For debugging
-%D purposes one can set the compresslevel to~0.
-
-\pdfoutput =1
-\pdfcompresslevel=9
-%\pdfthreadhoffset=\maxdimen
-%\pdfthreadvoffset=\maxdimen
-
-%D Now we have to make sure no other specials are supported,
-%D else \PDFTEX\ will keep on telling us that we're wrong.
-
-\unprotected \usespecials[\v!reset]
-
-%D Just in case we mimmick specials, we have to make sure no
-%D default specials end up in the process.
-
-\let\defaultspecial=\gobbleoneargument
-
-%D Having reset all the special support, we have to define
-%D all needed and possible support in this module.
-
-\startspecials[tpd]
-
-%D This means that by saying
-%D
-%D \starttypen
-%D \usespecials[tpd]
-%D \stoptypen
-%D
-%D we get ourselves \PDF\ output.
-
-%D \macros
-%D {dosetuppaper}
-%D
-%D If we don't set the paper size, \PDFTEX\ will certainly do
-%D it in a way we don't want, therefore we need:
-
-\def\dosetuppdftexpaper#1#2#3%
- {\global\pdfpagewidth =#2\relax
- \global\pdfpageheight=#3\relax
- \global\let\dosetuppdftexpaper=\gobblethreearguments}
-
-\definespecial\dosetuppaper#1#2#3%
- {\dosetuppdftexpaper{#1}{#2}{#3}}
-
-%D \macros
-%D {doinsertfile}
-%D
-%D Graphics are not part of \TEX\ and therefore not part of the
-%D \DVI\ standard. \PDF\ on the other hand has several graphic
-%D primitives. During the multi||step process \TEX\
-%D $\rightarrow$ \DVI\ $\rightarrow$ \POSTSCRIPT\ $\rightarrow$
-%D \PDF\ one can insert graphics using specials. In \PDFTEX\
-%D however there is only one step! This means that \PDFTEX\
-%D itself has to do the inclusion.
-%D
-%D At the moment \PDFTEX\ supports inclusion of bitmap \PNG\
-%D graphics as well as not too complicated \PDF\ code. Using
-%D this last option, we are able to include both \METAPOST\ and
-%D \PDF\ output produced by \GHOSTSCRIPT.
-%D
-%D We fall back on the generic \CONTEXT\ module supp-pdf to
-%D accomplish \PDF\ inclusion. The methods implemented there
-%D are hooked into both the figure placement mechanisms of
-%D \CONTEXT\ and the specials inclusion mechanism.
-
-\definespecial\doinsertfile#1#2#3#4#5#6#7#8#9%
- {\bgroup
- \dodoinsertfile{tpd}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}%
- \egroup}
-
-%D The three methods supported for the moment are \type{mps}
-%D for \METAPOST\ graphics, \type{pdf} for \GHOSTSCRIPT\ \PDF\
-%D code, and \type{png} for bitmap graphics.
-
-\def\dotpdinsertmps#1#2#3#4#5#6#7#8%
- {\scratchdimen=#2pt \PointsToReal{.01\scratchdimen}\xscale
- \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\yscale
- \convertMPtoPDF{#1}\xscale\yscale}
-
-\def\dotpdinsertpdf#1#2#3#4#5#6#7#8%
- {\beforesplitstring#1\at.\to\filename
- \scratchdimen=#2pt \PointsToReal{.01\scratchdimen}\xscale
- \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\yscale
- \convertPDFtoPDF{\filename.pdf}\xscale\yscale{#4sp}{#5sp}{#6sp}{#7sp}}
-
-\def\dotpdinsertpng#1#2#3#4#5#6#7#8%
- {\pdfimage width #6sp height #7sp #1\relax}
-
-%D Some surrogate \type{tif} and \type{eps} support is
-%D provided too. These work only when the size compatible
-%D \type{png} and \type{pdf} alternatives are present.
-
-\def\dotpdinserttif#1#2#3#4#5#6#7#8%
- {\beforesplitstring#1\at.\to\filename
- \pdfimage width #6sp height #7sp \filename.png\relax}
-
-\def\dotpdinserteps%
- {\dotpdinsertpdf}
-
-%D \PDF\ supports the inclusion of video movies. In \CONTEXT\
-%D we support these in a way similar to figure inclusion.
-
-\newcounter\currentmovie
-
-\def\dotpdinsertmov#1#2#3#4#5#6#7#8%
- {\ScaledPointsToBigPoints{#6}\width
- \ScaledPointsToBigPoints{#7}\height
- \edef\pdf@@posterize{\ifcase#8 \or/Poster true\fi}%
- \doglobal\increment\currentmovie
- \pdfannot
- width #6sp
- height -#7sp
- depth 0pt
- {/Border [0 0 0]
- /Subtype /Movie
- /Movie <</T (movie \currentmovie) /F (#1) /Aspect [\width\space \height\space] \pdf@@posterize>>
- /A <</ShowControls false>>}}
-
-%D \macros
-%D {doovalbox}
-%D
-%D For drawing ovals we use quite raw \PDF\ code. The next
-%D implementation does not differ that much from the one
-%D implemented in the \POSTSCRIPT\ driver.
-
-\def\dosomeovalcalc#1#2#3%
- {\dimen2=#1sp
- \advance\dimen2 by #2\relax
- \ScaledPointsToBigPoints{\number\dimen2}#3}
-
-\definespecial\doovalbox#1#2#3#4#5#6#7%
- {\bgroup
- \dimen0=#4sp\divide\dimen0 by 2
- \dosomeovalcalc{0} {+\dimen0}\xmin
- \dosomeovalcalc{#1}{-\dimen0}\xmax
- \dosomeovalcalc{#2}{-\dimen0}\ymax
- \dosomeovalcalc{-#3}{+\dimen0}\ymin
- \advance\dimen0 by #5sp
- \dosomeovalcalc{0} {+\dimen0}\xxmin
- \dosomeovalcalc{#1}{-\dimen0}\xxmax
- \dosomeovalcalc{#2}{-\dimen0}\yymax
- \dosomeovalcalc{-#3}{+\dimen0}\yymin
- \dosomeovalcalc{#4}{0pt}\stroke
- \dosomeovalcalc{#5}{0pt}\radius
- \edef\dostroke{#6}%
- \edef\dofill{#7}%
- \setbox0=\hbox
- {\pdfliteral
- {q
- \stroke\space w
- \xxmin\space \ymin\space m
- \xxmax\space \ymin\space l
- \xmax\space \ymin\space \xmax\space \yymin\space y
- \xmax\space \yymax\space l
- \xmax\space \ymax\space \xxmax\space \ymax\space y
- \xxmin\space \ymax\space l
- \xmin\space \ymax\space \xmin\space \yymax\space y
- \xmin\space \yymin\space l
- \xmin\space \ymin\space \xxmin\space \ymin\space y
- \ifnum\dostroke=1 S \fi
- \ifnum\dofill =1 f \fi
- Q}}%
- \wd0=#1sp\ht0=#2sp\dp0=#3sp\box0
- \egroup}
-
-%D \macros
-%D {dostartgraymode,dostopgraymode,
-%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,
-%D dostopcolormode}
-%D
-%D In \PDF\ there are two color states, one for strokes and one
-%D for fills. This means that we have to set the color in a
-%D rather redundant looking way. Unfortunately this makes the
-%D \PDF\ file much larger than needed.
-
-\definespecial\dostartgraymode#1%
- {\pdfliteral{#1 g #1 G}}
-
-\definespecial\dostopgraymode%
- {\pdfliteral{0 g 0 G}}
-
-\definespecial\dostartrgbcolormode#1#2#3%
- {\pdfliteral{#1 #2 #3 rg #1 #2 #3 RG}}
-
-\definespecial\dostartcmykcolormode#1#2#3#4%
- {\pdfliteral{#1 #2 #3 #4 k #1 #2 #3 #4 K}}
-
-\definespecial\dostartgraycolormode#1%
- {\pdfliteral{#1 g #1 G}}
-
-\definespecial\dostopcolormode%
- {\pdfliteral{0 g 0 G}}
-
-%D \macros
-%D {dostartrotation,dostoprotation}
-%D
-%D Rotating some text can be accomplished by setting the first
-%D four elements of the transform matrix. We only support some
-%D fixed angles. The q's take care of grouping.
-
-\definespecial\dostartrotation#1%
- {\processaction
- [#1]
- [ 90=>\pdfliteral{q 0 1 -1 0 0 0 cm},
- 180=>\pdfliteral{q -1 0 0 -1 0 0 cm},
- 270=>\pdfliteral{q 0 -1 1 0 0 0 cm},
- 360=>\pdfliteral{q 1 0 0 1 0 0 cm}]}
-
-\definespecial\dostoprotation%
- {\pdfliteral{Q}}
-
-%D \macros
-%D {dostartscaling,dostopscaling}
-%D
-%D Scaling is rather straightforward:
-
-\definespecial\dostartscaling#1#2%
- {\pdfliteral{q #1\space 0 0 #2\space 0 0 cm}}
-
-\definespecial\dostopscaling%
- {\pdfliteral{Q}}
-
-%D \macros
-%D {dostartmirroring,dostopmirroring}
-%D
-%D Mirroring is implemented in a similar way:
-
-\definespecial\dostartmirroring%
- {\pdfliteral{-1 0 0 1 0 0 cm}}
-
-\definespecial\dostopmirroring%
- {\pdfliteral{-1 0 0 1 0 0 cm}}
-
-%D \macros
-%D {dostartnegative,dostopnegative}
-%D
-%D When producng output for an image setter, sometimes
-%D negative output is needed.
-
-\definespecial\dostartnegative%
- {\writestatus{system}{negative not yet supported}}
-
-\definespecial\dostopnegative%
- {}
-
-%D \macros
-%D {dosetupinteraction}
-%D
-%D Nothing special is needed to enable \PDF\ commands and
-%D interaction. We stick with a message.
-
-\definespecial\dosetupinteraction%
- {\showmessage{\m!interactions}{21}{pdftex}}
-
-%D \macros
-%D {dostartthisisrealpage,dostartthisislocation
-%D dostartgotorealpage,dostartgotolocation,dostartgotoJS}
-%D
-%D The interactions macros are the core of this module. We
-%D support both page destinations and named ones.
-%D
-%D {\em For the moment we use object number (that is, behind
-%D the screens, the user uses his own numbers) destinations
-%D instead of page ones. The latter works, but not 100\%.}
-
-\definespecial\dostartthisisrealpage#1%
- {}
-
-\definespecial\dostartthisislocation#1%
- {\ifusepagedestinations \else
- \setPDFdestination{#1}%
- \doifsomething{\PDFdestination}
- {\pdfdest name {\PDFdestination} fit}%
- \fi}
-
-%D When going to a location, we obey the time and space saving
-%D boolean\type{\ifusepagedestination}. Names destinations are
-%D stripped and made robust.
-
-\definespecial\dostartgotolocation#1#2#3#4#5#6% url nog afhandelen
- {\bgroup
- \doifelsenothing{#3}
- {\doifelsenothing{#4}
- {\!!doneafalse}
- {\doifparentfileelse{#4}
- {\!!doneafalse}
- {\!!doneatrue}}%
- \ifusepagedestinations
- \scratchcounter=0#6\relax
- \edef\PDFdestination{\the\scratchcounter}%
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- attr {/Border [0 0 0]}
- goto \if!!donea file {#4.pdf} \fi page \PDFdestination\space{/Fit}%
- \pdfendlink
- \else
- \setPDFdestination{#5}%
- \doifsomething{\PDFdestination}
- {\pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- attr {/Border [0 0 0]}
- goto \if!!donea file {#4.pdf} \fi name {\PDFdestination}%
- \pdfendlink}%
- \fi}
- {\doifelsenothing{#4}
- {\let\PDFfile=\empty
- \let\PDFdestination=\empty}
- {\edef\PDFfile{/#4}%
- \setPDFdestination{#5}%
- \doifsomething{\PDFdestination}
- {\edef\PDFdestination{\URLhash\PDFdestination}}}%
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- user {/Subtype /Link
- /Border [0 0 0]
- /A << /Type /Action
- /S /URI
- /URI (#3\PDFfile\PDFdestination)>>}%
- \pdfendlink}%
- \egroup}
-
-\definespecial\dostartgotorealpage#1#2#3#4#5%
- {\bgroup
- \doifelsenothing{#3}
- {\doifelsenothing{#4}
- {\!!doneafalse}
- {\doifparentfileelse{#4}
- {\!!doneafalse}
- {\!!doneatrue}}%
- \scratchcounter=0#5\relax
- \edef\PDFdestination{\the\scratchcounter}%
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- attr {/Border [0 0 0]}
- goto \if!!donea file {#4.pdf} \fi page \PDFdestination\space{/Fit}%
- \pdfendlink}
- {\doifelsenothing{#4}
- {\let\PDFfile=\empty}
- {\edef\PDFfile{/#4}}%
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- user {/Subtype /Link
- /Border [0 0 0]
- /A << /Type /Action
- /S /URI
- /URI (#3\PDFfile)>>}%
- \pdfendlink}%
- \egroup}
-
-%D \macros
-%D {dostarthide,dostophide}
-%D
-%D Hiding parts of the document for printing is not yet
-%D supported by \PDF\ and therefore \PDFTEX.
-
-\definespecial\dostarthide%
- {}
-
-\definespecial\dostophide%
- {}
-
-%D \macros
-%D {dosetupscreen}
-%D
-%D Setting of the screen boundingbox involves some
-%D calculations. Here we also take care of (non) full screen
-%D startup. The dimensions are rounded.
-
-\definespecial\dosetupscreen#1#2#3#4#5%
- {\bgroup
- \!!widtha=#3sp
- \advance\!!widtha by #1sp
- \!!heighta=-#4sp
- \!!heightb=\pdfpageheight
- \advance\!!heightb by -#2sp
- \advance\!!heighta by \!!heightb
- \ScaledPointsToWholeBigPoints{#1}\left
- \ScaledPointsToWholeBigPoints{\number\!!heighta}\bottom
- \ScaledPointsToWholeBigPoints{\number\!!widtha}\width
- \ScaledPointsToWholeBigPoints{\number\!!heightb}\height
- \expanded{\global\noexpand\pdfpagesattr=
- {/CropBox [\left\space\bottom\space\width\space\height]}}%
- \ifcase#5%
- \pdfcatalog{} openaction goto page 1 {/Fit}%
- \else
- \pdfcatalog{/PageMode /FullScreen} openaction goto page 1 {/Fit}%
- \fi
- \egroup}
-
-%D \macros
-%D {dostartexecutecommand}
-%D
-%D \PDF\ viewers enable us to navigate using menus and shortcut
-%D keys. These navigational tools can also be accessed by using
-%D annotations. The next special takes care of inserting them.
-
-\def\PDFexecutestart {/Movie /T (movie \currentmovie) /Operation /Play}
-\def\PDFexecutestop {/Movie /T (movie \currentmovie) /Operation /Stop}
-\def\PDFexecutepause {/Movie /T (movie \currentmovie) /Operation /Pause}
-\def\PDFexecuteresume {/Movie /T (movie \currentmovie) /Operation /Resume}
-
-\def\PDFexecutefirst {/Named /N /First}
-\def\PDFexecuteprevious {/Named /N /Prev}
-\def\PDFexecutenext {/Named /N /Next}
-\def\PDFexecutelast {/Named /N /Last}
-\def\PDFexecutebackward {/Named /N /GoBack}
-\def\PDFexecuteforward {/Named /N /GoForward}
-\def\PDFexecuteprint {/Named /N /Print}
-\def\PDFexecuteexit {/Named /N /Quit}
-\def\PDFexecuteclose {/Named /N /Close}
-\def\PDFexecutesave {/Named /N /Save}
-\def\PDFexecutehelp {/Named /N /HelpUserGuide}
-\def\PDFexecuteswap {/Named /N /FullScreen}
-\def\PDFexecutesearch {/Named /N /Find}
-\def\PDFexecutesearchagain {/Named /N /FindAgain}
-
-\definespecial\dostartexecutecommand#1#2#3#4%
- {\doifdefined{PDFexecute#3}
- {\bgroup
- \ScaledPointsToBigPoints{#1}\width
- \ScaledPointsToBigPoints{#2}\height
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- user {/Subtype /Link
- /A <</S \getvalue{PDFexecute#3}>>
- /Border [0 0 0]}%
- \pdfendlink
- \egroup}}
-
-%D \macros
-%D {dosetupidentity}
-%D
-%D Documents can be tagged with an application accessible title
-%D and subtitle, the authorname, a date, the creator, keywords
-%D etc. For the moment \PDFTEX\ only supports the first three
-%D of these.
-
-\definespecial\dosetupidentity#1#2#3#4#5%
- {\pdfinfo
- {/Title (#1)
- /Subject (#2)
- /Author (#3)
- /Creator (#4)
- /Producer (pdfTeX)}}
-
-%D \macros
-%D {dostartrunprogam}
-%D
-%D Although possible, running applications is not yet
-%D implemented here.
-
-\definespecial\dostartrunprogram#1#2#3%
- {\bgroup
- \edef\string{#3}%
- \@EA\beforesplitstring\string\at{ }\to\program
- \@EA\aftersplitstring \string\at{ }\to\parameters
- \pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- user {/Subtype /Link
- /A <</S /Launch /F (\program) /P (\parameters)>>
- /Border [0 0 0]}%
- \pdfendlink
- \egroup}
-
-%D \macros
-%D {dostartgotoprofile, dostopgotoprofile,
-%D dobeginofprofile, doendofprofile}
-%D
-%D \CONTEXT\ user profiles and version control fall back on
-%D \PDF\ article threads. Unfortunately one cannot influence
-%D the view yet in an (for me) acceptable way.
-
-\definespecial\dostartgotoprofile#1#2#3%
- {\pdfannotlink
- width #1sp
- height #2sp
- depth 0pt
- attr {/Border [0 0 0]}
- thread name {#3}%
- \pdfendlink}
-
-\definespecial\dobeginofprofile#1#2#3#4%
- {\doifsomething{#1}
- {\pdfthread name {#1}}}
-
-\definespecial\doendofprofile%
- {\pdfendthread}
-
-%D \macros
-%D {doinsertbookmark}
-%D
-%D In \PDF\ bookmarks are the building blocks of a viewer
-%D provided sort of table of contents. \TEX\ has to provide
-%D the entry as well as the number of child entries. Strings
-%D need to be sanatized as good as possible to suit the default
-%D encoding. In \CONTEXT\ users can overrule this string by
-%D supplying an alternative one.
-
-\definespecial\doinsertbookmark#1#2#3#4#5% level sublevels text page open (1)
- {\sanitizePDFstring#3\to\bookmarktext
- \pdfoutline
- goto page #4\space
- \ifnum#2>0 count \ifcase#5-\fi#2\fi\space
- {\bookmarktext}}
-
-%D \macros
-%D {dostartobject,dostopobject,doinsertobject}
-%D
-%D Due to \PDF's object oriented character, we can include and
-%D reuse objects. These can be compared with \TEX's boxes. The
-%D \TEX\ counterpart is defined in the module \type{spec-dvi}.
-%D We don't use the dimensions here.
-
-% Forms can interfere with page dimension settings. Therefore
-% calling macros can best postpone flushing.
-
-%\definespecial\dostartobject#1#2#3#4%
-% {\setbox\nextbox=\vbox\bgroup
-% \def\dodostopobject%
-% {\egroup
-% \pdfform\nextbox
-% \scratchcounter=\pdflastform
-% \setxvalue{\r!driver#1}{\the\pdflastform}}}
-
-\definespecial\dostartobject#1#2#3#4%
- {\setbox\nextbox=\vbox\bgroup
- \def\dodostopobject%
- {\egroup
- \pdfform\nextbox
- \scratchcounter=\pdflastform
- \dosetobjectreference{#1}{\the\pdflastform}}}%
-
-\definespecial\dostopobject%
- {\dodostopobject}
-
-%\definespecial\doinsertobject#1%
-% {\expandafter\pdfrefform\csname\r!driver#1\endcsname\relax}
-
-\definespecial\doinsertobject#1%
- {\dogetobjectreference{#1}\objectreference
- \pdfrefform\objectreference}
-
-%\definespecial\dogetobjectreference#1#2%
-% {\edef#2{\csname\r!driver#1\endcsname}}
-
-%D \macros
-%D {dosetpagetransitions}
-%D
-%D Page transitions only make sence in presentations. They are
-%D passed as raw \PDF\ code to the page object. This
-%D implementation looks much like the one in \type{spec-pdf}.
-
-\def\PDFpagesplit {/S /Split }
-\def\PDFpageblinds {/S /Blinds }
-\def\PDFpagebox {/S /Box }
-\def\PDFpagewipe {/S /Wipe }
-\def\PDFpagedissolve {/S /Dissolve }
-\def\PDFpageglitter {/S /Glitter }
-\def\PDFpagereplace {/S /R }
-
-\def\PDFpagehorizontal {/Dm /H }
-\def\PDFpagevertical {/Dm /V }
-\def\PDFpagein {/M /I }
-\def\PDFpageout {/M /O }
-\def\PDFpageeast {/Di 0 }
-\def\PDFpagenorth {/Di 90 }
-\def\PDFpagewest {/Di 180 }
-\def\PDFpagesouth {/Di 270 }
-
-\def\dosetPDFpagetransition#1%
- {\doifdefined{PDFpage#1}
- {\edef\PDFpagetransitions{\PDFpagetransitions\getvalue{PDFpage#1}}}}
-
-\def\dosetpagetransition#1%
- {\let\PDFpagetransitions=\empty
- \processcommalist[#1]\dosetPDFpagetransition
- \expanded{\global\noexpand\pdfpageattr{/Trans <<\PDFpagetransitions>>}}}
-
-\def\pagetransitions % replace not in this list
- {{split,in,vertical},{split,in,horizontal},{split,out,vertical},{split,out,horizontal},
- {blinds,horizontal},{blinds,vertical},
- {box,in},{box,out},
- {wipe,east},{wipe,west},{wipe,north},{wipe,south},
- dissolve,
- {glitter,east},{glitter,south}}
-
-%D The expansion is needed because else the \type{\pdfpageattr}
-%D token list flushes an unexpanded \type{\csname}. The
-%D \type{\global} is needed because the assignment can take
-%D place deeply buried (for instance in the \type{\shipout}
-%D box.
-
-\stopspecials
-
-\protect
-
-\endinput
+%D \module
+%D [ file=spec-tpd,
+%D version=1996.01.25,
+%D title=\CONTEXT\ Special Macros,
+%D subtitle=\PDFTEX,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. Non||commercial use is
+%C granted.
+
+% /Border -> /B, evt meer indirecte objecten!
+
+%D Being one of the first typographical systems able to support
+%D advances \PDF\ support, \TEX\ is also one of the first
+%D systems to produce high quality \PDF\ code directly. Thanks
+%D to Han The Thanh c.s. the \TEX\ community can leap forward
+%D once again.
+%D
+%D One important characteristic of \PDFTEX\ is that is can
+%D produce standard \DVI\ code as well as \PDF\ code. This
+%D enables us to use one format file to support both output
+%D formats.
+%D
+%D All modules in this group use specials to tell drivers what
+%D non||\TEX\ actions to take. Because from the \TEX\ point of
+%D view, there is no difference between \DVI\ and \PDF, we
+%D therefore only have to bend the \DVI\ driver support into
+%D \PDF\ support. Technically spoken, specials no longer serve
+%D a purpose, except from ending up as comment in the \PDF\
+%D file. The core primitive in this module therefore is the
+%D \PDFTEX\ primitive \type{\pdfliteral}.
+%D
+%D Before we continue we need to make sure if indeed those
+%D \PDFTEX\ primitives are permitted. If no primitives are
+%D available, we just stop reading any further.
+
+\ifx\pdftexversion\undefined \endinput \else \unprotect \fi
+
+%D Once we are sure that we're indeed supporting \PDFTEX, we
+%D force \PDF\ output at the highest compression. For debugging
+%D purposes one can set the compresslevel to~0.
+
+\pdfoutput =1
+\pdfcompresslevel=9
+%\pdfthreadhoffset=\maxdimen
+%\pdfthreadvoffset=\maxdimen
+
+%D Now we have to make sure no other specials are supported,
+%D else \PDFTEX\ will keep on telling us that we're wrong.
+
+\unprotected \usespecials[\v!reset]
+
+%D Just in case we mimmick specials, we have to make sure no
+%D default specials end up in the process.
+
+\let\defaultspecial=\gobbleoneargument
+
+%D Having reset all the special support, we have to define
+%D all needed and possible support in this module.
+
+\startspecials[tpd]
+
+%D This means that by saying
+%D
+%D \starttypen
+%D \usespecials[tpd]
+%D \stoptypen
+%D
+%D we get ourselves \PDF\ output.
+
+%D \macros
+%D {dosetuppaper}
+%D
+%D If we don't set the paper size, \PDFTEX\ will certainly do
+%D it in a way we don't want, therefore we need:
+
+\def\dosetuppdftexpaper#1#2#3%
+ {\global\pdfpagewidth =#2\relax
+ \global\pdfpageheight=#3\relax
+ \global\let\dosetuppdftexpaper=\gobblethreearguments}
+
+\definespecial\dosetuppaper#1#2#3%
+ {\dosetuppdftexpaper{#1}{#2}{#3}}
+
+%D \macros
+%D {doinsertfile}
+%D
+%D Graphics are not part of \TEX\ and therefore not part of the
+%D \DVI\ standard. \PDF\ on the other hand has several graphic
+%D primitives. During the multi||step process \TEX\
+%D $\rightarrow$ \DVI\ $\rightarrow$ \POSTSCRIPT\ $\rightarrow$
+%D \PDF\ one can insert graphics using specials. In \PDFTEX\
+%D however there is only one step! This means that \PDFTEX\
+%D itself has to do the inclusion.
+%D
+%D At the moment \PDFTEX\ supports inclusion of bitmap \PNG\
+%D graphics as well as not too complicated \PDF\ code. Using
+%D this last option, we are able to include both \METAPOST\ and
+%D \PDF\ output produced by \GHOSTSCRIPT.
+%D
+%D We fall back on the generic \CONTEXT\ module supp-pdf to
+%D accomplish \PDF\ inclusion. The methods implemented there
+%D are hooked into both the figure placement mechanisms of
+%D \CONTEXT\ and the specials inclusion mechanism.
+
+\definespecial\doinsertfile#1#2#3#4#5#6#7#8#9%
+ {\bgroup
+ \dodoinsertfile{tpd}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}%
+ \egroup}
+
+%D The three methods supported for the moment are \type{mps}
+%D for \METAPOST\ graphics, \type{pdf} for \GHOSTSCRIPT\ \PDF\
+%D code, and \type{png} for bitmap graphics.
+
+\def\dotpdinsertmps#1#2#3#4#5#6#7#8%
+ {\scratchdimen=#2pt \PointsToReal{.01\scratchdimen}\xscale
+ \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\yscale
+ \convertMPtoPDF{#1}\xscale\yscale}
+
+\def\dotpdinsertpdf#1#2#3#4#5#6#7#8%
+ {\beforesplitstring#1\at.\to\filename
+ \scratchdimen=#2pt \PointsToReal{.01\scratchdimen}\xscale
+ \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\yscale
+ \convertPDFtoPDF{\filename.pdf}\xscale\yscale{#4sp}{#5sp}{#6sp}{#7sp}}
+
+\def\dotpdinsertpng#1#2#3#4#5#6#7#8%
+ {\pdfimage width #6sp height #7sp #1\relax}
+
+%D Some surrogate \type{tif} and \type{eps} support is
+%D provided too. These work only when the size compatible
+%D \type{png} and \type{pdf} alternatives are present.
+
+\def\dotpdinserttif#1#2#3#4#5#6#7#8%
+ {\beforesplitstring#1\at.\to\filename
+ \pdfimage width #6sp height #7sp \filename.png\relax}
+
+\def\dotpdinserteps%
+ {\dotpdinsertpdf}
+
+%D \PDF\ supports the inclusion of video movies. In \CONTEXT\
+%D we support these in a way similar to figure inclusion.
+
+\newcounter\currentmovie
+
+\def\dotpdinsertmov#1#2#3#4#5#6#7#8%
+ {\bgroup
+ \ScaledPointsToBigPoints{#6}\width
+ \ScaledPointsToBigPoints{#7}\height
+ \edef\pdf@@posterize{\ifcase#8 \or/Poster true\fi}%
+ \doglobal\increment\currentmovie
+ \pdfannot
+ width #6sp
+ height -#7sp
+ depth 0pt
+ {/Border [0 0 0]
+ /Subtype /Movie
+ /Movie <</T (movie \currentmovie) /F (#1) /Aspect [\width\space \height\space] \pdf@@posterize>>
+ /A <</ShowControls false>>}%
+ \egroup}
+
+%D \macros
+%D {doovalbox}
+%D
+%D For drawing ovals we use quite raw \PDF\ code. The next
+%D implementation does not differ that much from the one
+%D implemented in the \POSTSCRIPT\ driver.
+
+\def\dosomeovalcalc#1#2#3%
+ {\dimen2=#1sp
+ \advance\dimen2 by #2\relax
+ \ScaledPointsToBigPoints{\number\dimen2}#3}
+
+\definespecial\doovalbox#1#2#3#4#5#6#7%
+ {\bgroup
+ \dimen0=#4sp\divide\dimen0 by 2
+ \dosomeovalcalc{0} {+\dimen0}\xmin
+ \dosomeovalcalc{#1}{-\dimen0}\xmax
+ \dosomeovalcalc{#2}{-\dimen0}\ymax
+ \dosomeovalcalc{-#3}{+\dimen0}\ymin
+ \advance\dimen0 by #5sp
+ \dosomeovalcalc{0} {+\dimen0}\xxmin
+ \dosomeovalcalc{#1}{-\dimen0}\xxmax
+ \dosomeovalcalc{#2}{-\dimen0}\yymax
+ \dosomeovalcalc{-#3}{+\dimen0}\yymin
+ \dosomeovalcalc{#4}{0pt}\stroke
+ \dosomeovalcalc{#5}{0pt}\radius
+ \edef\dostroke{#6}%
+ \edef\dofill{#7}%
+ \setbox0=\hbox
+ {\pdfliteral
+ {q
+ \stroke\space w
+ \xxmin\space \ymin\space m
+ \xxmax\space \ymin\space l
+ \xmax\space \ymin\space \xmax\space \yymin\space y
+ \xmax\space \yymax\space l
+ \xmax\space \ymax\space \xxmax\space \ymax\space y
+ \xxmin\space \ymax\space l
+ \xmin\space \ymax\space \xmin\space \yymax\space y
+ \xmin\space \yymin\space l
+ \xmin\space \ymin\space \xxmin\space \ymin\space y
+ \ifnum\dostroke=1 S \fi
+ \ifnum\dofill =1 f \fi
+ Q}}%
+ \wd0=#1sp\ht0=#2sp\dp0=#3sp\box0
+ \egroup}
+
+%D \macros
+%D {dostartgraymode,dostopgraymode,
+%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,
+%D dostopcolormode}
+%D
+%D In \PDF\ there are two color states, one for strokes and one
+%D for fills. This means that we have to set the color in a
+%D rather redundant looking way. Unfortunately this makes the
+%D \PDF\ file much larger than needed.
+
+\definespecial\dostartgraymode#1%
+ {\pdfliteral{#1 g #1 G}}
+
+\definespecial\dostopgraymode%
+ {\pdfliteral{0 g 0 G}}
+
+\definespecial\dostartrgbcolormode#1#2#3%
+ {\pdfliteral{#1 #2 #3 rg #1 #2 #3 RG}}
+
+\definespecial\dostartcmykcolormode#1#2#3#4%
+ {\pdfliteral{#1 #2 #3 #4 k #1 #2 #3 #4 K}}
+
+\definespecial\dostartgraycolormode#1%
+ {\pdfliteral{#1 g #1 G}}
+
+\definespecial\dostopcolormode%
+ {\pdfliteral{0 g 0 G}}
+
+%D \macros
+%D {dostartrotation,dostoprotation}
+%D
+%D Rotating some text can be accomplished by setting the first
+%D four elements of the transform matrix. We only support some
+%D fixed angles. The q's take care of grouping.
+
+\definespecial\dostartrotation#1%
+ {\processaction
+ [#1]
+ [ 90=>\pdfliteral{q 0 1 -1 0 0 0 cm},
+ 180=>\pdfliteral{q -1 0 0 -1 0 0 cm},
+ 270=>\pdfliteral{q 0 -1 1 0 0 0 cm},
+ 360=>\pdfliteral{q 1 0 0 1 0 0 cm}]}
+
+\definespecial\dostoprotation%
+ {\pdfliteral{Q}}
+
+%D \macros
+%D {dostartscaling,dostopscaling}
+%D
+%D Scaling is rather straightforward:
+
+\definespecial\dostartscaling#1#2%
+ {\pdfliteral{q #1\space 0 0 #2\space 0 0 cm}}
+
+\definespecial\dostopscaling%
+ {\pdfliteral{Q}}
+
+%D \macros
+%D {dostartmirroring,dostopmirroring}
+%D
+%D Mirroring is implemented in a similar way:
+
+\definespecial\dostartmirroring%
+ {\pdfliteral{-1 0 0 1 0 0 cm}}
+
+\definespecial\dostopmirroring%
+ {\pdfliteral{-1 0 0 1 0 0 cm}}
+
+%D \macros
+%D {dostartnegative,dostopnegative}
+%D
+%D When producng output for an image setter, sometimes
+%D negative output is needed.
+
+\definespecial\dostartnegative%
+ {\writestatus{system}{negative not yet supported}}
+
+\definespecial\dostopnegative%
+ {}
+
+%D \macros
+%D {dosetupinteraction}
+%D
+%D Nothing special is needed to enable \PDF\ commands and
+%D interaction. We stick with a message.
+
+\definespecial\dosetupinteraction%
+ {\showmessage{\m!interactions}{21}{pdftex}}
+
+%D \macros
+%D {dostartthisisrealpage,dostartthisislocation
+%D dostartgotorealpage,dostartgotolocation,dostartgotoJS}
+%D
+%D The interactions macros are the core of this module. We
+%D support both page destinations and named ones.
+%D
+%D {\em For the moment we use object number (that is, behind
+%D the screens, the user uses his own numbers) destinations
+%D instead of page ones. The latter works, but not 100\%.}
+
+\definespecial\dostartthisisrealpage#1%
+ {}
+
+\definespecial\dostartthisislocation#1%
+ {\bgroup
+ \setPDFdestination{#1}%
+ \doifsomething{\PDFdestination}
+ {\pdfdest name {\PDFdestination} fit}%
+ \egroup}
+
+%D When going to a location, we obey the time and space saving
+%D boolean\type{\ifusepagedestination}. Names destinations are
+%D stripped and made robust.
+
+\definespecial\dostartgotolocation#1#2#3#4#5#6% url nog afhandelen
+ {\bgroup
+ \doifelsenothing{#3}
+ {\setPDFdestination{#5}%
+ \doifsomething{\PDFdestination}
+ {\doifelsenothing{#4}
+ {\!!doneafalse}
+ {\doifparentfileelse{#4}
+ {\!!doneafalse}
+ {\!!doneatrue}}%
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ attr {/Border [0 0 0]}
+ goto \if!!donea file {#4.pdf} \fi name {\PDFdestination}%
+ \pdfendlink}}
+ {\doifelsenothing{#4}
+ {\let\PDFfile=\empty
+ \let\PDFdestination=\empty}
+ {\edef\PDFfile{/#4}%
+ \setPDFdestination{#5}%
+ \doifsomething{\PDFdestination}
+ {\edef\PDFdestination{\URLhash\PDFdestination}}}%
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ user {/Subtype /Link
+ /Border [0 0 0]
+ /A << /Type /Action
+ /S /URI
+ /URI (#3\PDFfile\PDFdestination)>>}%
+ \pdfendlink}%
+ \egroup}
+
+\definespecial\dostartgotorealpage#1#2#3#4#5%
+ {\bgroup
+ \doifelsenothing{#3}
+ {\doifelsenothing{#4}
+ {\!!doneafalse}
+ {\doifparentfileelse{#4}
+ {\!!doneafalse}
+ {\!!doneatrue}}%
+ \scratchcounter=0#5\relax
+ \edef\PDFdestination{\the\scratchcounter}%
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ attr {/Border [0 0 0]}
+ goto \if!!donea file {#4.pdf} \fi page \PDFdestination {/Fit}%
+ \pdfendlink}
+ {\doifelsenothing{#4}
+ {\let\PDFfile=\empty}
+ {\edef\PDFfile{/#4}}%
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ user {/Subtype /Link
+ /Border [0 0 0]
+ /A << /Type /Action
+ /S /URI
+ /URI (#3\PDFfile)>>}%
+ \pdfendlink}%
+ \egroup}
+
+\definespecial\dostartgotoJS#1#2#3%
+ {\bgroup
+ \ifx\doPSsanitizeJScode\undefined \else
+ \doPSsanitizeJScode{#3}%
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ user {/Subtype /Link
+ /Border [0 0 0]
+ /A << /Type /Action
+ /S /JavaScript
+ /JS (\sanitizedJScode) >>}%
+ \pdfendlink
+ \fi
+ \egroup}
+
+%D {\em Tijdelijk hier!}
+
+\definespecial\doflushJSpreamble#1%
+ {\bgroup
+ \ifx\doPSsanitizeJScode\undefined \else
+ \let\compositeJScode=\empty
+ \def\docommando##1%
+ {\expanded{\doPSsanitizeJScode{\getJSpreamble{##1}}}%
+ \pdfobj{<< /S /JavaScript /JS (\sanitizedJScode) >>}%
+ \edef\compositeJScode%
+ {\compositeJScode\space (##1) \the\pdflastobj\space 0 R}}%
+ \processcommalist[#1]\docommando
+ \pdfobj{<< /JavaScript << /Names [ \compositeJScode ] >> >>}%
+ \pdfcatalog{/Names \the\pdflastobj\space 0 R}%
+ \fi
+ \egroup}
+
+%D \macros
+%D {dostarthide,dostophide}
+%D
+%D Hiding parts of the document for printing is not yet
+%D supported by \PDF\ and therefore \PDFTEX.
+
+\definespecial\dostarthide%
+ {}
+
+\definespecial\dostophide%
+ {}
+
+%D \macros
+%D {dosetupscreen}
+%D
+%D Setting of the screen boundingbox involves some
+%D calculations. Here we also take care of (non) full screen
+%D startup. The dimensions are rounded.
+
+\definespecial\dosetupscreen#1#2#3#4#5%
+ {\bgroup
+ \!!widtha=#3sp
+ \advance\!!widtha by #1sp
+ \!!heighta=-#4sp
+ \!!heightb=\pdfpageheight
+ \advance\!!heightb by -#2sp
+ \advance\!!heighta by \!!heightb
+ \ScaledPointsToWholeBigPoints{#1}\left
+ \ScaledPointsToWholeBigPoints{\number\!!heighta}\bottom
+ \ScaledPointsToWholeBigPoints{\number\!!widtha}\width
+ \ScaledPointsToWholeBigPoints{\number\!!heightb}\height
+ \expanded{\global\noexpand\pdfpagesattr=
+ {/CropBox [\left\space\bottom\space\width\space\height]}}%
+ \ifcase#5%
+ \pdfcatalog{} openaction goto page 1 {/Fit}%
+ \else
+ \pdfcatalog{/PageMode /FullScreen} openaction goto page 1 {/Fit}%
+ \fi
+ \egroup}
+
+%D \macros
+%D {dostartexecutecommand}
+%D
+%D \PDF\ viewers enable us to navigate using menus and shortcut
+%D keys. These navigational tools can also be accessed by using
+%D annotations. The next special takes care of inserting them.
+
+\def\PDFexecutestart {/Movie /T (movie \currentmovie) /Operation /Play}
+\def\PDFexecutestop {/Movie /T (movie \currentmovie) /Operation /Stop}
+\def\PDFexecutepause {/Movie /T (movie \currentmovie) /Operation /Pause}
+\def\PDFexecuteresume {/Movie /T (movie \currentmovie) /Operation /Resume}
+
+\def\PDFexecutefirst {/Named /N /First}
+\def\PDFexecuteprevious {/Named /N /Prev}
+\def\PDFexecutenext {/Named /N /Next}
+\def\PDFexecutelast {/Named /N /Last}
+\def\PDFexecutebackward {/Named /N /GoBack}
+\def\PDFexecuteforward {/Named /N /GoForward}
+\def\PDFexecuteprint {/Named /N /Print}
+\def\PDFexecuteexit {/Named /N /Quit}
+\def\PDFexecuteclose {/Named /N /Close}
+\def\PDFexecutesave {/Named /N /Save}
+\def\PDFexecutehelp {/Named /N /HelpUserGuide}
+\def\PDFexecuteswap {/Named /N /FullScreen}
+\def\PDFexecutesearch {/Named /N /Find}
+\def\PDFexecutesearchagain {/Named /N /FindAgain}
+
+\definespecial\dostartexecutecommand#1#2#3#4%
+ {\doifdefined{PDFexecute#3}
+ {\bgroup
+ \ScaledPointsToBigPoints{#1}\width
+ \ScaledPointsToBigPoints{#2}\height
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ user {/Subtype /Link
+ /A <</S \getvalue{PDFexecute#3}>>
+ /Border [0 0 0]}%
+ \pdfendlink
+ \egroup}}
+
+%D \macros
+%D {dosetupidentity}
+%D
+%D Documents can be tagged with an application accessible title
+%D and subtitle, the authorname, a date, the creator, keywords
+%D etc. For the moment \PDFTEX\ only supports the first three
+%D of these.
+
+\definespecial\dosetupidentity#1#2#3#4#5%
+ {\pdfinfo
+ {/Title (#1)
+ /Subject (#2)
+ /Author (#3)
+ /Creator (#4)
+ /Producer (pdfTeX)}}
+
+%D \macros
+%D {dostartrunprogam}
+%D
+%D Although possible, running applications is not yet
+%D implemented here.
+
+\definespecial\dostartrunprogram#1#2#3%
+ {\bgroup
+ \edef\string{#3}%
+ \@EA\beforesplitstring\string\at{ }\to\program
+ \@EA\aftersplitstring \string\at{ }\to\parameters
+ \pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ user {/Subtype /Link
+ /A <</S /Launch /F (\program) /P (\parameters)>>
+ /Border [0 0 0]}%
+ \pdfendlink
+ \egroup}
+
+%D \macros
+%D {dostartgotoprofile, dostopgotoprofile,
+%D dobeginofprofile, doendofprofile}
+%D
+%D \CONTEXT\ user profiles and version control fall back on
+%D \PDF\ article threads. Unfortunately one cannot influence
+%D the view yet in an (for me) acceptable way.
+
+\definespecial\dostartgotoprofile#1#2#3%
+ {\pdfannotlink
+ width #1sp
+ height #2sp
+ depth 0pt
+ attr {/Border [0 0 0]}
+ thread name {#3}%
+ \pdfendlink}
+
+\definespecial\dobeginofprofile#1#2#3#4%
+ {\doifsomething{#1}
+ {\pdfthread name {#1}}}
+
+\definespecial\doendofprofile%
+ {\pdfendthread}
+
+%D \macros
+%D {doinsertbookmark}
+%D
+%D In \PDF\ bookmarks are the building blocks of a viewer
+%D provided sort of table of contents. \TEX\ has to provide
+%D the entry as well as the number of child entries. Strings
+%D need to be sanatized as good as possible to suit the default
+%D encoding. In \CONTEXT\ users can overrule this string by
+%D supplying an alternative one.
+
+\definespecial\doinsertbookmark#1#2#3#4#5% level sublevels text page open (1)
+ {\bgroup
+ \sanitizePDFstring#3\to\bookmarktext
+ \pdfoutline
+ goto page #4\space
+ \ifnum#2>0 count \ifcase#5-\fi#2\fi\space
+ {\bookmarktext}%
+ \egroup}
+
+%D \macros
+%D {dostartobject,dostopobject,doinsertobject}
+%D
+%D Due to \PDF's object oriented character, we can include and
+%D reuse objects. These can be compared with \TEX's boxes. The
+%D \TEX\ counterpart is defined in the module \type{spec-dvi}.
+%D We don't use the dimensions here.
+
+% Forms can interfere with page dimension settings. Therefore
+% calling macros can best postpone flushing.
+
+\definespecial\dostartobject#1#2#3#4%
+ {\bgroup
+ \setbox\nextbox=\vbox\bgroup
+ \def\dodostopobject%
+ {\egroup
+ \pdfform\nextbox
+ \scratchcounter=\pdflastform
+ \dosetobjectreference{#1}{\the\pdflastform}}}%
+
+\definespecial\dostopobject%
+ {\dodostopobject
+ \egroup}
+
+\definespecial\doinsertobject#1%
+ {\bgroup
+ \dogetobjectreference{#1}\objectreference
+ \pdfrefform\objectreference
+ \egroup}
+
+%D \macros
+%D {dosetpagetransitions}
+%D
+%D Page transitions only make sence in presentations. They are
+%D passed as raw \PDF\ code to the page object. This
+%D implementation looks much like the one in \type{spec-pdf}.
+
+\def\PDFpagesplit {/S /Split }
+\def\PDFpageblinds {/S /Blinds }
+\def\PDFpagebox {/S /Box }
+\def\PDFpagewipe {/S /Wipe }
+\def\PDFpagedissolve {/S /Dissolve }
+\def\PDFpageglitter {/S /Glitter }
+\def\PDFpagereplace {/S /R }
+
+\def\PDFpagehorizontal {/Dm /H }
+\def\PDFpagevertical {/Dm /V }
+\def\PDFpagein {/M /I }
+\def\PDFpageout {/M /O }
+\def\PDFpageeast {/Di 0 }
+\def\PDFpagenorth {/Di 90 }
+\def\PDFpagewest {/Di 180 }
+\def\PDFpagesouth {/Di 270 }
+
+\def\dosetPDFpagetransition#1%
+ {\doifdefined{PDFpage#1}
+ {\edef\PDFpagetransitions{\PDFpagetransitions\getvalue{PDFpage#1}}}}
+
+\def\dosetpagetransition#1%
+ {\let\PDFpagetransitions=\empty
+ \processcommalist[#1]\dosetPDFpagetransition
+ \expanded{\global\noexpand\pdfpageattr{/Trans <<\PDFpagetransitions>>}}}
+
+\def\pagetransitions % replace not in this list
+ {{split,in,vertical},{split,in,horizontal},{split,out,vertical},{split,out,horizontal},
+ {blinds,horizontal},{blinds,vertical},
+ {box,in},{box,out},
+ {wipe,east},{wipe,west},{wipe,north},{wipe,south},
+ dissolve,
+ {glitter,east},{glitter,south}}
+
+%D The expansion is needed because else the \type{\pdfpageattr}
+%D token list flushes an unexpanded \type{\csname}. The
+%D \type{\global} is needed because the assignment can take
+%D place deeply buried (for instance in the \type{\shipout}
+%D box.
+
+\stopspecials
+
+\protect
+
+\endinput