nochmal dasselbe

This commit is contained in:
Klaus Wendel, archium GmbH 2021-03-02 15:39:29 +01:00
parent 1022ea11e9
commit 041ba85cc6

25
fpdf.go
View File

@ -67,6 +67,7 @@ func fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr string, size SizeType)
if unitStr == "" {
unitStr = "mm"
}
if sizeStr == "" {
sizeStr = "A4"
}
@ -3482,7 +3483,29 @@ func (f *Fpdf) getpagesizestr(sizeStr string) (size SizeType) {
sizeStr = strings.ToLower(sizeStr)
// dbg("Size [%s]", sizeStr)
var ok bool
size, ok = f.stdPageSizes[sizeStr]
//20210302 archium addendum begin
//enable custom page formats
if strings.Contains(sizeStr, "x") {
var (
aString []string
aFloat []float64
aErr error
)
aString = strings.Split(sizeStr, "x")
for i := 0; i <= 1; i++ {
aFloat[i], aErr = strconv.ParseFloat(aString[i], 64)
if aErr != nil {
f.err = fmt.Errorf("unknown page size %s", sizeStr)
}
}
size, ok = SizeType{aFloat[0], aFloat[1]}, true
} else {
//20210302 archium addendum end
size, ok = f.stdPageSizes[sizeStr]
//20210302 archium addendum begin
}
//20210302 archium addendum end
if ok {
// dbg("found %s", sizeStr)
size.Wd /= f.k