signintech / gopdf

A simple library for generating PDF written in Go lang
MIT License
2.54k stars 273 forks source link

How to parse the HTML file to convert to PDF #248

Open sarithaN opened 1 year ago

sarithaN commented 1 year ago

Hi, I want to parse the HTML and pass the dynamic data to the HTML and then convert to PDF. tmpl, err := template.ParseFiles("./templates/pdf-template.html") err = tmpl.Execute(&buf, data) pdf := gopdf.GoPdf{} pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4}) pdf.AddTTFFont("roboto", "../assets/fonts/Roboto-Medium.ttf") pdf.SetFont("roboto", "", 14) pdf.AddPage()

is there any function available to add the text to PDF directly. eg: pdf.HTMLToString(buf.String());

vantaboard commented 3 months ago

@oneplus1000 can you close this issue if it has been resolved? This issue is beyond the scope of the library.