Add default values for the signature field

This commit is contained in:
Adrian-George Bostan 2019-02-21 20:24:06 +02:00
parent 657fe00a78
commit b33ad302be
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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
}