Closed mmcmm closed 5 years ago
Can you include the smallest possible program that causes these problems?
Does the following program work for you?
package main
import (
"fmt"
"os"
"github.com/jung-kurt/gofpdf/v2"
)
func main() {
pdf := gofpdf.New("P", "mm", "A4", "")
pdf.AddPage()
pdf.SetFont("Arial", "B", 16)
pdf.Cell(40, 10, "Hello, world")
err := pdf.OutputFileAndClose("hello.pdf")
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
}
Thank you for the reply, turns out it was my issue, I was doing all the drawing in the header function and I guess when you call AddPage from the header function some kind of recursion forms.
Thanks for the followup!
When I use AddPage I just get a white/blank file, and can't seem to figure it why, I even tried with the basic examples. Also auto page break point doesn't work. If I use AddPage after I have written to the document I get some infinite loop as it crashes.
Thanks