Go to start of banner

# What do the elements a, b, c, d, h, v mean in a matrix like the ASFixedMatrix?

Go to start of metadata

You are viewing an old version of this page. View the current version.

Version 5

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

1. a and b are the scale factors in X and Y positions of the movement in x
2. c and d are scale factors in X and Y positions of the movement in y
3. 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 scale 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 effect prior to the transformation. That is, if you add scaling, so that the size of the element is doubled (a = 2), the units applying to values h and 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 transformed system:

Xnew = (a * Xold) + (c * Yold) + h and Ynew = (b * Xold) + (d * Yold) + v

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

thus:

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

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

```     void PDFMatrixRotate(ASFixedMatrix *M, float Angle)
{
float  Ad = Angle;
double Sina, Cosa;
double Ma, Mb, Mc, Md;
while (Ad < 0)
while (Ad > 360.0)
if (Ad < 0.0001)
return;
Ma = FixedToFloat (M->a);
Mb = FixedToFloat (M->b);
Mc = FixedToFloat (M->c);
Md = FixedToFloat (M->d);
Sina = sin (Ad);
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://kb.datalogics.com/pages/viewpage.action?pageId=43941917", "fetch_time": 1660806619000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2022-33/segments/1659882573172.64/warc/CC-MAIN-20220818063910-20220818093910-00235.warc.gz", "warc_record_offset": 330160156, "warc_record_length": 14862, "token_count": 655, "char_count": 2083, "score": 3.796875, "int_score": 4, "crawl": "CC-MAIN-2022-33", "snapshot_type": "latest", "language": "en", "language_score": 0.8303341865539551, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00036-of-00064.parquet"}