title: How to create an image with HTML template in node.js
body: <p>I have a HTML template file in node js. And I want to convert that template with into image by replacing static values with dynamic values. Suppose I have a below HTML template saved in any variable in my CONFIG file:</p>
  
  <pre><code>const puppeteer = require('puppeteer')
  const htmlString = `&lt;html&gt;
                      &lt;head&gt;
                        &lt;title&gt;&lt;/title&gt;
                      &lt;/head&gt;
                      &lt;body&gt;
                        &lt;div class="container" style="height:500px;width:450px;border:1px solid silver;margin:0 auto"&gt;
                          &lt;header style="height:200px;background-image: url('https://i.imgur.com/a1ItuWs.jpg');"&gt;
                              &lt;center&gt;
                                &lt;span style="font-size:55px;color:white;font-weight: bold;font-family: arial;margin-top:20px"&gt;Hello&lt;/span&gt;
                                &lt;br&gt;
                                &lt;span style="font-size: 35px;color: white"&gt;rajat&lt;/span&gt;
                                &lt;br&gt;&lt;br&gt;
                                &lt;span style="font-size:20px;color: white;font-family: arial;"&gt;from biondi Goh&lt;/span&gt;
                              &lt;/center&gt;
                          &lt;/header&gt;
                          &lt;section style="height: 280px;background: #ecfaff"&gt;
                            &lt;center&gt;
                              &lt;span style="font-size: 30px;font-family: arial;"&gt;rajat subject&lt;/span&gt;
                              &lt;br&gt;&lt;br&gt;
                              &lt;span style="font-size: 20px;font-family: arial;"&gt;rajat paragraph 1&lt;/span&gt;
                              &lt;br&gt;&lt;br&gt;
                              &lt;span style="font-size: 20px;font-family: arial;color:red;"&gt;RAJAT INTEREST&lt;/span&gt;
                              &lt;br&gt;&lt;br&gt;
                              &lt;span style="font-size: 20px;font-family: arial;"&gt;rajat Paragraph 2&lt;/span&gt;
                            &lt;/center&gt;
                          &lt;/section&gt;
                          &lt;footer style="height:20px;background: #ecfaff;text-align: center;font-family: arial;"&gt;
                              &lt;span&gt;http://biondi.assured.sg&lt;/span&gt;
                          &lt;/footer&gt;
                        &lt;/div&gt;
                      &lt;/body&gt;
                      &lt;/html&gt;`;
  
  (async () =&gt; {
    const browser = await puppeteer.launch()
    const page = await browser.newPage()
    await page.setContent(htmlString)
    await page.screenshot({path: 'example.png',type: "jpeg", quality: 100})
    await browser.close()
  })()
  </code></pre>
  
  <p>I want to create above HTML image. Can anyone please suggest me library for this?</p>