SebastiaanKlippert / go-wkhtmltopdf

Golang commandline wrapper for wkhtmltopdf
MIT License
1.06k stars 146 forks source link

Second page of pdf don't display any content #118

Closed sandeep1027 closed 1 year ago

sandeep1027 commented 1 year ago

Hi,

I try this code `htmlfile, err := ioutil.ReadFile("htmlsimple1.html") if err != nil { log.Fatal(err) } page1 := wkhtmltopdf.NewPageReader(bytes.NewReader(htmlfile)) page1.EnableLocalFileAccess.Set(true) //needed to include js page1.FooterHTML.Set("footer.html") page1.HeaderHTML.Set("header.html") pdfg.AddPage(page1)

htmlfile1, err1 := ioutil.ReadFile("htmlsimple.html")
if err1 != nil {
 log.Fatal(err1)
}
page2 := wkhtmltopdf.NewPageReader(bytes.NewReader(htmlfile1))
pdfg.AddPage(page2)
err = pdfg.Create()`

Pdf first page display content fine but in second page is show blank page.

SebastiaanKlippert commented 1 year ago

See https://pkg.go.dev/github.com/SebastiaanKlippert/go-wkhtmltopdf#PageReader you can only add one page from memory (stdin).

https://github.com/SebastiaanKlippert/go-wkhtmltopdf/issues/74 https://github.com/SebastiaanKlippert/go-wkhtmltopdf/issues/54

Anything else is technically not possible.