v0.0.496 wpdf fixes and wpdf test.go
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m58s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m58s
This commit is contained in:
@@ -20,6 +20,7 @@ type PDFMultiCellOpt struct {
|
||||
textColor *PDFColor
|
||||
borderColor *PDFColor
|
||||
fillColor *PDFColor
|
||||
debug *bool
|
||||
}
|
||||
|
||||
func NewPDFMultiCellOpt() *PDFMultiCellOpt {
|
||||
@@ -128,6 +129,16 @@ func (opt *PDFMultiCellOpt) Alpha(alpha float64, blendMode PDFBlendMode) *PDFMul
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *PDFMultiCellOpt) Debug(v bool) *PDFMultiCellOpt {
|
||||
opt.debug = &v
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *PDFMultiCellOpt) Copy() *PDFMultiCellOpt {
|
||||
c := *opt
|
||||
return &c
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
|
||||
txtTR := b.tr(txt)
|
||||
@@ -146,6 +157,7 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
var textColor *PDFColor
|
||||
var borderColor *PDFColor
|
||||
var fillColor *PDFColor
|
||||
debug := b.debug
|
||||
|
||||
for _, opt := range opts {
|
||||
width = langext.Coalesce(opt.width, width)
|
||||
@@ -162,6 +174,7 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
textColor = langext.CoalesceOpt(opt.textColor, textColor)
|
||||
borderColor = langext.CoalesceOpt(opt.borderColor, borderColor)
|
||||
fillColor = langext.CoalesceOpt(opt.fillColor, fillColor)
|
||||
debug = langext.Coalesce(opt.debug, debug)
|
||||
}
|
||||
|
||||
if fontNameOverride != nil || fontStyleOverride != nil || fontSizeOverride != nil {
|
||||
@@ -203,8 +216,14 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
b.b.SetX(*x)
|
||||
}
|
||||
|
||||
xBefore, yBefore := b.b.GetXY()
|
||||
|
||||
b.b.MultiCell(width, height, txtTR, string(border), string(align), fill)
|
||||
|
||||
if debug {
|
||||
b.Rect(b.GetPageWidth()-xBefore-b.GetMarginRight(), b.GetY()-yBefore, RectOutline, NewPDFRectOpt().X(xBefore).Y(yBefore).LineWidth(0.25).DrawColor(0, 128, 0))
|
||||
}
|
||||
|
||||
if extraLn != 0 {
|
||||
b.b.Ln(extraLn)
|
||||
}
|
||||
|
Reference in New Issue
Block a user