Is it possible to generate PDF/screenshots from HTML template instead of URL
in chrome dp library?
func printToPDF(urlstr string, res *[]byte) chromedp.Tasks {
return chromedp.Tasks{
chromedp.Navigate(urlstr),
//page.SetDocumentContent("body", "<h1>Hello world</h1>"), Something like this is this possible?
chromedp.ActionFunc(func(ctx context.Context) error {
buf, _, err := page.PrintToPDF().WithPrintBackground(false).Do(ctx)
if err != nil {
return err
}
*res = buf
return nil
}),
}
}
Link to library: https://github.com/chromedp/chromedp