mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-01 22:17:29 +08:00
Improve signature annotation rectangle drawing
This commit is contained in:
parent
3f049d474e
commit
85e62c3c30
@ -366,19 +366,26 @@ func genFieldSignatureAppearance(fields []*SignatureLine, opts *SignatureFieldOp
|
||||
offsetY += (rectHeight - float64(len(lines))*lineHeight) / 2
|
||||
}
|
||||
|
||||
// Draw signature.
|
||||
// Draw annotation rectangle.
|
||||
cc := contentstream.NewContentCreator()
|
||||
|
||||
if opts.BorderSize > 0 {
|
||||
cc.Add_q().
|
||||
Add_re(rect[0], rect[1], rectWidth, rectHeight).
|
||||
Add_w(opts.BorderSize).
|
||||
SetStrokingColor(opts.BorderColor).
|
||||
SetNonStrokingColor(opts.FillColor).
|
||||
Add_B().
|
||||
Add_Q()
|
||||
if opts.BorderSize <= 0 {
|
||||
opts.BorderSize = 0
|
||||
opts.BorderColor = model.NewPdfColorDeviceGray(1)
|
||||
}
|
||||
if opts.BorderColor == nil {
|
||||
opts.FillColor = model.NewPdfColorDeviceGray(1)
|
||||
}
|
||||
if opts.FillColor == nil {
|
||||
opts.FillColor = model.NewPdfColorDeviceGray(1)
|
||||
}
|
||||
|
||||
cc.Add_q().Add_re(rect[0], rect[1], rectWidth, rectHeight).
|
||||
Add_w(opts.BorderSize).SetStrokingColor(opts.BorderColor).
|
||||
SetNonStrokingColor(opts.FillColor).
|
||||
Add_B().Add_Q()
|
||||
|
||||
// Draw signature.
|
||||
cc.Add_q()
|
||||
cc.Translate(rect[0], rect[3]-lineHeight-offsetY)
|
||||
cc.Add_BT()
|
||||
|
Loading…
x
Reference in New Issue
Block a user