PDF Tm运算符 [英] PDF Tm operator
问题描述
我正在尝试突出显示PDF文档中的文本,但是我发现了一个Tm运算符,其操作数如下:
I'm trying to highlight text in a PDF document but I found a Tm operator with the following operands:
0 7.98 -7.98 0 90.8898 715.4183 Tm
假定Tm运算符仅在其操作数上替换文本矩阵和文本行矩阵. 根据Pdf参考,可以执行以下操作:
The Tm operator is supposed to replace the text matrix and the text line matrix solely on its operands. According to the Pdf Reference, the following operations can be done:
- 翻译[1 0 0 1 tx ty]
- 缩放[sx 0 0 sy 0 0]
- 旋转[cos(角度)sin(角度)-sin(角度)cos(角度)0 0]
- 倾斜[1 tan(alpha)tan(beta)1 0 0]
操作数的格式与上述任何转换都不匹配,从而导致以下问题.
The format of the operands doesn't match any of the above transformations, which led to the following questions.
- 前面提到的文本矩阵应该做什么?
- 几种转换的样子如何?例如缩放和旋转.
推荐答案
前面提到的文本矩阵应该做什么?
您的矩阵
0 7.98 -7.98 0 90.8898 715.4183
(这是PDF的缩写形式
(which is the PDF short form for
⌈ 0 7.98 0 ⌉
| -7.98 0 0 |
⌊ 90.8898 715.4183 1 ⌋
不幸的是,确实很难画出大括号)
and unfortunately it is difficult to draw big brackets indeed)
是90°旋转,7.98的缩放和90.8898、715.4183的平移操作的组合.我将在下面分别估算这些数字:7.98 8、90.8898 91和715.4183 715:
is a combination of a 90° rotation, a scaling by 7.98, and a translation operation by 90.8898, 715.4183. I'll approximate those numbers in the following, 7.98 ≅8, 90.8898 ≅ 91, and 715.4183 ≅ 715:
⌈ 0 8 0 ⌉ ⌈ 0 8 0 ⌉ ⌈ 1 0 0 ⌉
| -8 0 0 | = | -8 0 0 | x | 0 1 0 |
⌊ 91 715 1 ⌋ ⌊ 0 0 1 ⌋ ⌊ 91 715 1 ⌋
⌈ 8 0 0 ⌉ ⌈ 0 1 0 ⌉ ⌈ 1 0 0 ⌉
= | 0 8 0 | x | -1 0 0 | x | 0 1 0 |
⌊ 0 0 1 ⌋ ⌊ 0 0 1 ⌋ ⌊ 91 715 1 ⌋
几个转换的样子如何?例如缩放和旋转
在上面的分解中,我们有一个这样的例子,
We have such an example in the decomposition above,
⌈ 0 8 0 ⌉ ⌈ 8 0 0 ⌉ ⌈ 0 1 0 ⌉
| -8 0 0 | = | 0 8 0 | x | -1 0 0 |
⌊ 0 0 1 ⌋ ⌊ 0 0 1 ⌋ ⌊ 0 0 1 ⌋
缩放比例为8,旋转角度为90°.
a combination of a scaling by 8 and a rotation by 90°.
这篇关于PDF Tm运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!