mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
Add default values for the signature field
This commit is contained in:
parent
657fe00a78
commit
b33ad302be
@ -405,6 +405,10 @@ func (a *PdfAppender) Sign(pageNum int, field *PdfFieldSignature) error {
|
||||
|
||||
// Add signature field annotations to the page annotations.
|
||||
field.P = page.ToPdfObject()
|
||||
if field.T == nil || field.T.String() == "" {
|
||||
field.T = core.MakeString(fmt.Sprintf("Signature %d", page))
|
||||
}
|
||||
|
||||
page.Annotations = append(page.Annotations, field.PdfAnnotationWidget.PdfAnnotation)
|
||||
|
||||
// Add signature field to the form.
|
||||
@ -412,6 +416,7 @@ func (a *PdfAppender) Sign(pageNum int, field *PdfFieldSignature) error {
|
||||
if acroForm == nil {
|
||||
acroForm = NewPdfAcroForm()
|
||||
}
|
||||
acroForm.SigFlags = core.MakeInteger(3)
|
||||
|
||||
fields := append(acroForm.AllFields(), field.PdfField)
|
||||
acroForm.Fields = &fields
|
||||
|
@ -451,6 +451,7 @@ func NewPdfFieldSignature(signature *PdfSignature) *PdfFieldSignature {
|
||||
field.PdfAnnotationWidget.container = field.PdfField.container
|
||||
|
||||
field.T = core.MakeString("")
|
||||
field.F = core.MakeInteger(132)
|
||||
field.V = signature
|
||||
return field
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user