signintech / gopdf

A simple library for generating PDF written in Go lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to parse the HTML file to convert to PDF

sarithaN opened this issue · comments

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());