v0.0.494 add tables to wpdf
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Has been cancelled
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package wpdf
|
||||
|
||||
import "gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
import (
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/dataext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
)
|
||||
|
||||
type PDFMultiCellOpt struct {
|
||||
width *float64
|
||||
@@ -11,6 +14,7 @@ type PDFMultiCellOpt struct {
|
||||
fontNameOverride *PDFFontFamily
|
||||
fontStyleOverride *PDFFontStyle
|
||||
fontSizeOverride *float64
|
||||
alphaOverride *dataext.Tuple[float64, PDFBlendMode]
|
||||
extraLn *float64
|
||||
x *float64
|
||||
textColor *PDFColor
|
||||
@@ -119,6 +123,11 @@ func (opt *PDFMultiCellOpt) FillColorHex(c uint32) *PDFMultiCellOpt {
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *PDFMultiCellOpt) Alpha(alpha float64, blendMode PDFBlendMode) *PDFMultiCellOpt {
|
||||
opt.alphaOverride = &dataext.Tuple[float64, PDFBlendMode]{V1: alpha, V2: blendMode}
|
||||
return opt
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
|
||||
txtTR := b.tr(txt)
|
||||
@@ -131,6 +140,7 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
var fontNameOverride *PDFFontFamily
|
||||
var fontStyleOverride *PDFFontStyle
|
||||
var fontSizeOverride *float64
|
||||
var alphaOverride *dataext.Tuple[float64, PDFBlendMode]
|
||||
extraLn := float64(0)
|
||||
var x *float64
|
||||
var textColor *PDFColor
|
||||
@@ -146,6 +156,7 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
fontNameOverride = langext.CoalesceOpt(opt.fontNameOverride, fontNameOverride)
|
||||
fontStyleOverride = langext.CoalesceOpt(opt.fontStyleOverride, fontStyleOverride)
|
||||
fontSizeOverride = langext.CoalesceOpt(opt.fontSizeOverride, fontSizeOverride)
|
||||
alphaOverride = langext.CoalesceOpt(opt.alphaOverride, alphaOverride)
|
||||
extraLn = langext.Coalesce(opt.extraLn, extraLn)
|
||||
x = langext.CoalesceOpt(opt.x, x)
|
||||
textColor = langext.CoalesceOpt(opt.textColor, textColor)
|
||||
@@ -182,6 +193,12 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
defer func() { b.SetFillColor(oldColorR, oldColorG, oldColorB) }()
|
||||
}
|
||||
|
||||
if alphaOverride != nil {
|
||||
oldA, oldBMS := b.b.GetAlpha()
|
||||
b.b.SetAlpha(alphaOverride.V1, string(alphaOverride.V2))
|
||||
defer func() { b.b.SetAlpha(oldA, oldBMS) }()
|
||||
}
|
||||
|
||||
if x != nil {
|
||||
b.b.SetX(*x)
|
||||
}
|
||||
|
Reference in New Issue
Block a user