如何理解pdf格式标志?

问题描述 投票:0回答:1

我使用pdfbox读取了pdf结构,但无法从流中找到一些数据:

1 g
0 0 18 18 re
f
0.5 0.5 17 17 re
s
q
1 1 16 16 re
W
n
0 g
BT
/ZaDb 14.532 Tf
2.853 4.081 Td
13.9943 TL
(4) Tj
ET
Q

是有关复选框的流信息,但是字母是什么意思?谁能向我解释,或者如果您可以与我分享我可以阅读的内容会更好?enter image description here

java itext itext7
1个回答
0
投票
1 g                 --- select DeviceGray WHITE as non-stroking color
0 0 18 18 re        --- define a 18×18 rectangular path, lower left at 0,0
f                   --- fill the path with the non-stroking color
0.5 0.5 17 17 re    --- define a 17×17 rectangular path, lower left at 0.5,0.5
s                   --- stroke the path with the stroking color
q                   --- save graphics state
1 1 16 16 re        --- define a 16×16 rectangular path, lower left at 1,1
W                   --- intersect the current clip path with the just defined path
n                   --- don't draw the path
0 g                 --- select DeviceGray BLACK as non-stroking color
BT                  --- begin text object
/ZaDb 14.532 Tf     --- select font with name ZaDb at size 14.532
2.853 4.081 Td      --- move text insertion point by 2.853,4.081
13.9943 TL          --- set leading to 13.9943
(4) Tj              --- draw the string with one character with character code 0x34 (what you display as "4" is the byte 0x34)
ET                  --- end text object
Q                   --- restore graphics state

哪个字符的字符代码为0x34取决于ZaDb的定义方式。您应该能够在您关注的XObject形式的字体资源中找到它。

尽管很有可能,ZaDb是具有ZapfDingbats编码的ZapfDingbats字体,请参见ISO 32000-2附件D.6。在这种情况下,字符代码0x34对应于✔。

换句话说,您的表单XObject绘制一个具有黑色边缘和白色内部的正方形,然后在该正方形内部绘制一个黑色刻度。

© www.soinside.com 2019 - 2024. All rights reserved.