As in PostScript, in the Adobe PDF Library the matrix is the pri= mary method used to control where PDF elements are placed on a page, and th= e size (scale) of those elements:

- a and b are the scale factors in X and Y positions of the movement in x=
- c and d are scale factors in X and Y positions of the movement in y
- h and v are absolute displacement in X and Y distances

These values are expressed in the format [a b c d h v]. So the first four numbers of the matrix are scal= e factors, and have no units. The last two describe how the object twill be= moved on the page. These two final values are in the units that were in ef= fect prior to the transformation. That is, if you add scaling, so that the = size of the element is doubled (a =3D 2), the units applying to values h an= d v will also double.

To scale an element evenly, use [Scale 0 0 Scale 0 0].

To move an element to a given point, use [1 0 0 1 Xpos Ypos].

The default unit is 1/72 of an inch, or one point. So [1 0 0 1 72 72] would move an object one inch (72 = points) to the right (h, or horizontal) and one inch (72 points) up (v, or = vertical).

Or, in another example, applying the matrix [2 0 0 1 -10 10] at a current position of [10,10] would take you to [10,20] in the transform= ed system:

*Xnew* =3D (a * X*old*) + (c * Y*old*) + h and Y*new =3D (b * X old) + (d * Yold) + v*

where: a =3D 2; b =3D 0; c =3D 0; d =3D 1; h =3D -10; v =3D 10; Xold =3D 10= ; Yold =3D 10

thus:

10 =3D (2 * 10) + (0 * 10) + (-10) and 20 =3D (0 * 10) + (1 * 10) + 10

To rotate an image on the page a matrix, use the following algorithm as = a guide:

=20

vo= id PDFMatrixRotate(ASFixedMatrix *M, float Angle)=20 {=20 float Ad =3D Angle;=20 double Sina, Cosa;=20 double Ma, Mb, Mc, Md; while (Ad < 0)=20 Ad +=3D 360; while (Ad > 360.0)=20 Ad =3D Ad - 360.0; if (Ad < 0.0001)=20 return; Ad *=3D DEGREES_TO_RADIANS;=20 Ma =3D FixedToFloat (M->a);=20 Mb =3D FixedToFloat (M->b);=20 Mc =3D FixedToFloat (M->c);=20 Md =3D FixedToFloat (M->d); Sina =3D sin (Ad);=20 Cosa=3D cos (Ad); M->a =3D FloatToFixed ((Cosa * Ma) - (Sina * Mc));=20 M->b =3D FloatToFixed ((Cosa * Mb) + (Sina * Ma));=20 M->c =3D FloatToFixed ((Cosa * Mc) - (Sina * Md));=20 M->d =3D FloatToFixed ((Cosa * Md) + (Sina * Mc)); return;=20 }=20

For more information about matrices, see Section 8.3.3, =E2=80=9CCommon = Transformations,=E2=80=9D in the ISO 32000 Reference, page 117 and Sec= tion 8.3.4, =E2=80=9CTransformation Matrices,=E2=80=9D on page 119. Find th= is document on the web store of the International Standards Organization (I= SO).