Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
d0d72167eb
|
|||
a55ee1a6ce
|
|||
dfc319573c
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.451"
|
||||
const GoextVersion = "0.0.454"
|
||||
|
||||
const GoextVersionTimestamp = "2024-05-14T12:46:49+0200"
|
||||
const GoextVersionTimestamp = "2024-05-14T15:10:27+0200"
|
||||
|
@@ -206,95 +206,11 @@ func ImageCompressonValuesMeta() []enums.EnumMetaValue {
|
||||
}
|
||||
}
|
||||
|
||||
// ================================ MimeCategory ================================
|
||||
//
|
||||
// File: mime.go
|
||||
// StringEnum: true
|
||||
// DescrEnum: false
|
||||
// DataEnum: false
|
||||
//
|
||||
|
||||
var __MimeCategoryValues = []MimeCategory{
|
||||
CatDocument,
|
||||
CatImage,
|
||||
CatVideo,
|
||||
CatContainer,
|
||||
}
|
||||
|
||||
var __MimeCategoryVarnames = map[MimeCategory]string{
|
||||
CatDocument: "CatDocument",
|
||||
CatImage: "CatImage",
|
||||
CatVideo: "CatVideo",
|
||||
CatContainer: "CatContainer",
|
||||
}
|
||||
|
||||
func (e MimeCategory) Valid() bool {
|
||||
return langext.InArray(e, __MimeCategoryValues)
|
||||
}
|
||||
|
||||
func (e MimeCategory) Values() []MimeCategory {
|
||||
return __MimeCategoryValues
|
||||
}
|
||||
|
||||
func (e MimeCategory) ValuesAny() []any {
|
||||
return langext.ArrCastToAny(__MimeCategoryValues)
|
||||
}
|
||||
|
||||
func (e MimeCategory) ValuesMeta() []enums.EnumMetaValue {
|
||||
return MimeCategoryValuesMeta()
|
||||
}
|
||||
|
||||
func (e MimeCategory) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e MimeCategory) VarName() string {
|
||||
if d, ok := __MimeCategoryVarnames[e]; ok {
|
||||
return d
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (e MimeCategory) TypeName() string {
|
||||
return "MimeCategory"
|
||||
}
|
||||
|
||||
func (e MimeCategory) PackageName() string {
|
||||
return "media"
|
||||
}
|
||||
|
||||
func (e MimeCategory) Meta() enums.EnumMetaValue {
|
||||
return enums.EnumMetaValue{VarName: e.VarName(), Value: e, Description: nil}
|
||||
}
|
||||
|
||||
func ParseMimeCategory(vv string) (MimeCategory, bool) {
|
||||
for _, ev := range __MimeCategoryValues {
|
||||
if string(ev) == vv {
|
||||
return ev, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
func MimeCategoryValues() []MimeCategory {
|
||||
return __MimeCategoryValues
|
||||
}
|
||||
|
||||
func MimeCategoryValuesMeta() []enums.EnumMetaValue {
|
||||
return []enums.EnumMetaValue{
|
||||
CatDocument.Meta(),
|
||||
CatImage.Meta(),
|
||||
CatVideo.Meta(),
|
||||
CatContainer.Meta(),
|
||||
}
|
||||
}
|
||||
|
||||
// ================================ ================= ================================
|
||||
|
||||
func AllPackageEnums() []enums.Enum {
|
||||
return []enums.Enum{
|
||||
ImageFitStretch, // ImageFit
|
||||
CompressionPNGNone, // ImageCompresson
|
||||
CatDocument, // MimeCategory
|
||||
}
|
||||
}
|
||||
|
28
wpdf/wpdf.go
28
wpdf/wpdf.go
@@ -6,12 +6,13 @@ import (
|
||||
)
|
||||
|
||||
type WPDFBuilder struct {
|
||||
b *gofpdf.Fpdf
|
||||
tr func(string) string
|
||||
cellHeight float64
|
||||
fontName PDFFontFamily
|
||||
fontStyle PDFFontStyle
|
||||
fontSize float64
|
||||
b *gofpdf.Fpdf
|
||||
tr func(string) string
|
||||
cellHeight float64
|
||||
cellSpacing float64
|
||||
fontName PDFFontFamily
|
||||
fontStyle PDFFontStyle
|
||||
fontSize float64
|
||||
}
|
||||
|
||||
type PDFMargins struct {
|
||||
@@ -38,9 +39,10 @@ func NewPDFBuilder(orientation PDFOrientation, size PDFSize, unicode bool) *WPDF
|
||||
}
|
||||
|
||||
b := &WPDFBuilder{
|
||||
b: fpdfbuilder,
|
||||
tr: tr,
|
||||
cellHeight: 5,
|
||||
b: fpdfbuilder,
|
||||
tr: tr,
|
||||
cellHeight: 5,
|
||||
cellSpacing: 1,
|
||||
}
|
||||
|
||||
b.SetMargins(PDFMargins{Left: 15, Top: 25, Right: 15}) // default values
|
||||
@@ -49,6 +51,10 @@ func NewPDFBuilder(orientation PDFOrientation, size PDFSize, unicode bool) *WPDF
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) FPDF() *gofpdf.Fpdf {
|
||||
return b.b
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) SetMargins(v PDFMargins) {
|
||||
b.b.SetMargins(v.Left, v.Top, v.Right)
|
||||
}
|
||||
@@ -99,6 +105,10 @@ func (b *WPDFBuilder) SetFont(fontName PDFFontFamily, fontStyle PDFFontStyle, fo
|
||||
b.cellHeight = b.b.PointConvert(fontSize)
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) SetCellSpacing(h float64) {
|
||||
b.cellSpacing = h
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) Ln(h float64) {
|
||||
b.b.Ln(h)
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@ func (b *WPDFBuilder) Cell(txt string, opts ...*PDFCellOpt) {
|
||||
txtTR := b.tr(txt)
|
||||
|
||||
width := float64(0)
|
||||
height := b.cellHeight
|
||||
height := b.cellHeight + b.cellSpacing
|
||||
border := BorderNone
|
||||
ln := BreakToNextLine
|
||||
align := AlignLeft
|
||||
|
@@ -91,7 +91,7 @@ func (b *WPDFBuilder) MultiCell(txt string, opts ...*PDFMultiCellOpt) {
|
||||
txtTR := b.tr(txt)
|
||||
|
||||
width := float64(0)
|
||||
height := b.cellHeight
|
||||
height := b.cellHeight + b.cellSpacing
|
||||
border := BorderNone
|
||||
align := AlignLeft
|
||||
fill := false
|
||||
|
Reference in New Issue
Block a user