Browse Source

nochmal dasselbe

master
Klaus Wendel 2 years ago
parent
commit
041ba85cc6
  1. 25
      fpdf.go

25
fpdf.go

@ -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

Loading…
Cancel
Save