[pdftex] CTM changed with \pdfxform

Heiko Oberdiek oberdiek at uni-freiburg.de
Tue Dec 24 20:54:17 CET 2002


On Tue, Dec 24, 2002 at 05:36:24PM +0100, Andreas Matthias wrote:

> The following example draws two arrows. The first uses a \pdfxform,
> whereas the second inserts the code of the former \pdfxform directly.
> But the result is not the same since the CTM is modified by 
> \pdfxform. (The CTM is changed just before the form is inserted
> by the operator Do):
> 
>   1 0 0 1 0 -10 cm
>   /Fm1 Do
> 
> In the Form XObject itself the CTM is not modified!
> 
> Can someone explain me this box alignment?
> Why is the CTM changed with \pdfxform?
> 
> 
> ,----[ test.tex ]

(These code citation style prevents and discourages easy cut&paste.)

> | \pdfcompresslevel0
> | 
> | \setbox0=\vbox to 10bp{\vfill\hbox to 15bp{%
> |   \pdfliteral{0 0 m 15 5 l 0 10 l 4 5 l f}}}
> | \pdfxform 0
> | 
> | \edef\arrow{\pdflastxform}
> | 
> | test\vskip50pt
> | 
> | \pdfliteral{0 0 m 50 0 l S q 1 0 0 1 50 0 cm}%
    \pdfrefxform\arrow%
    \pdfliteral{Q}

Here you are in vertical mode, so these three things
will put below each other. The second box has height 10bp,
therefore it is moved 10bp down: 1 0 0 1 0 -10 cm

> | \vskip50pt
> | \pdfliteral{0 0 m 50 0 l S q 1 0 0 1 50 0 cm 0 0 m 15 5 l 0 10 l 4 5 l f Q}
> | 
> | \end
> `----

Solution:

\noindent
\pdfliteral{...}%
\pdfrefxform\arrow
\pdfliteral direct{Q}% or without direct, but you need no CTM setting here

Yours sincerely and happy Christmas
  Heiko <oberdiek at uni-freiburg.de>



More information about the pdftex mailing list