How to understand pdf forms flags?

倖福魔咒の 提交于 2020-04-30 06:37:15

问题


I read pdf structure using pdfbox and I can't find out some data from stream:

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

It is stream information about checkbox but what does it mean that letters? Can anyone explain to me or it would be better if you can share with me where I can read about it?


回答1:


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

Which character has the character code 0x34, depends on how ZaDb is defined. You should be able to find its definition in the font resources of the form XObject you focus on.

Quite likely, though, ZaDb is a ZapfDingbats font with ZapfDingbats encoding, see ISO 32000-2 annex D.6. In that case the character code 0x34 corresponds to ✔.

In other words, your form XObject draws a square with black edges and white insides, and then draws a black tick inside that square.



来源:https://stackoverflow.com/questions/59102525/how-to-understand-pdf-forms-flags

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!