mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-02 22:17:06 +08:00
Draw annotation Rect to text field appearances as well
This commit is contained in:
parent
3536d323fb
commit
72bb06194f
@ -147,6 +147,13 @@ func genFieldTextAppearance(wa *model.PdfAnnotationWidget, ftxt *model.PdfFieldT
|
|||||||
width := rect[2] - rect[0]
|
width := rect[2] - rect[0]
|
||||||
height := rect[3] - rect[1]
|
height := rect[3] - rect[1]
|
||||||
|
|
||||||
|
if mkDict, has := core.GetDict(wa.MK); has {
|
||||||
|
err := style.applyAppearanceCharacteristics(mkDict, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get and process the default appearance string (DA) operands.
|
// Get and process the default appearance string (DA) operands.
|
||||||
da := getDA(ftxt.PdfField)
|
da := getDA(ftxt.PdfField)
|
||||||
csp := contentstream.NewContentStreamParser(da)
|
csp := contentstream.NewContentStreamParser(da)
|
||||||
@ -156,6 +163,9 @@ func genFieldTextAppearance(wa *model.PdfAnnotationWidget, ftxt *model.PdfFieldT
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc := contentstream.NewContentCreator()
|
cc := contentstream.NewContentCreator()
|
||||||
|
if style.BorderSize > 0 {
|
||||||
|
drawRect(cc, style, width, height)
|
||||||
|
}
|
||||||
cc.Add_BMC("Tx")
|
cc.Add_BMC("Tx")
|
||||||
cc.Add_q()
|
cc.Add_q()
|
||||||
// Graphic state changes.
|
// Graphic state changes.
|
||||||
@ -391,6 +401,13 @@ func genFieldTextCombAppearance(wa *model.PdfAnnotationWidget, ftxt *model.PdfFi
|
|||||||
width := rect[2] - rect[0]
|
width := rect[2] - rect[0]
|
||||||
height := rect[3] - rect[1]
|
height := rect[3] - rect[1]
|
||||||
|
|
||||||
|
if mkDict, has := core.GetDict(wa.MK); has {
|
||||||
|
err := style.applyAppearanceCharacteristics(mkDict, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
maxLen, has := core.GetIntVal(ftxt.MaxLen)
|
maxLen, has := core.GetIntVal(ftxt.MaxLen)
|
||||||
if !has {
|
if !has {
|
||||||
return nil, errors.New("maxlen not set")
|
return nil, errors.New("maxlen not set")
|
||||||
@ -410,6 +427,9 @@ func genFieldTextCombAppearance(wa *model.PdfAnnotationWidget, ftxt *model.PdfFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc := contentstream.NewContentCreator()
|
cc := contentstream.NewContentCreator()
|
||||||
|
if style.BorderSize > 0 {
|
||||||
|
drawRect(cc, style, width, height)
|
||||||
|
}
|
||||||
cc.Add_BMC("Tx")
|
cc.Add_BMC("Tx")
|
||||||
cc.Add_q()
|
cc.Add_q()
|
||||||
// Graphic state changes.
|
// Graphic state changes.
|
||||||
@ -568,6 +588,9 @@ func genFieldCheckboxAppearance(wa *model.PdfAnnotationWidget, fbtn *model.PdfFi
|
|||||||
xformOn := model.NewXObjectForm()
|
xformOn := model.NewXObjectForm()
|
||||||
{
|
{
|
||||||
cc := contentstream.NewContentCreator()
|
cc := contentstream.NewContentCreator()
|
||||||
|
if style.BorderSize > 0 {
|
||||||
|
drawRect(cc, style, width, height)
|
||||||
|
}
|
||||||
|
|
||||||
fontsize := style.AutoFontSizeFraction * height
|
fontsize := style.AutoFontSizeFraction * height
|
||||||
|
|
||||||
@ -595,10 +618,6 @@ func genFieldCheckboxAppearance(wa *model.PdfAnnotationWidget, fbtn *model.PdfFi
|
|||||||
}
|
}
|
||||||
ty += 1.0
|
ty += 1.0
|
||||||
|
|
||||||
if style.BorderSize > 0 {
|
|
||||||
drawRect(cc, style, width, height)
|
|
||||||
}
|
|
||||||
|
|
||||||
cc.Add_q().
|
cc.Add_q().
|
||||||
Add_g(0).
|
Add_g(0).
|
||||||
Add_BT().
|
Add_BT().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user