title: chromedp golang: How to create screenshot and pdf from template HTML string instead of URL?
body: <p>Is it possible to generate PDF/screenshots from HTML template instead of <code>URL</code> in chrome dp library?</p>
  <pre><code>func printToPDF(urlstr string, res *[]byte) chromedp.Tasks {
      return chromedp.Tasks{
          chromedp.Navigate(urlstr),
          //page.SetDocumentContent(&quot;body&quot;, &quot;&lt;h1&gt;Hello world&lt;/h1&gt;&quot;), 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
          }),
      }
  }
  </code></pre>
  <p>Link to library: <a href="https://github.com/chromedp/chromedp" rel="nofollow noreferrer">https://github.com/chromedp/chromedp</a></p>