title: Image is not rendering from dynamic image path while using express html-pdf package
body: <p>I'm using the Html-pdf package to generate and download pdf in an express-MongoDB application. Here is the route, where I've used the Html-pdf package.</p>
  <pre><code>
  //@route - GET /generate PDF
  router.get(&quot;/generateReport/:id&quot;, async (req, res) =&gt; {
  
      const tableDataById = await newsModel.findById(req.params.id);
      ejs.renderFile(path.join(__dirname, '../views/pages/', &quot;pdf.ejs&quot;), {output:tableDataById}, (err, data) =&gt; {
          
          if (err) {
              res.send(err);
          } else {
              var assesPath = path.join('file://',__dirname,'../public/');
              assesPath = assesPath.replace(new RegExp(/\\/g), '/');
  
              var options = {
                  &quot;height&quot;: &quot;11.25in&quot;,
                  &quot;width&quot;: &quot;8.5in&quot;,
                  &quot;header&quot;: {
                      &quot;height&quot;: &quot;20mm&quot;,
                  },
                  &quot;footer&quot;: {
                      &quot;height&quot;: &quot;20mm&quot;,
                  },
                  &quot;base&quot;: &quot;file:///&quot; + assesPath
              };
              pdf.create(data, options).toBuffer(function (err, buffer) {
                   if (err) {
                       res.send(err);
                   } else {    
                       res.type('pdf');
                       res.end(buffer,'binary')
                   }
               });
          }
      });
  });
  </code></pre>
  <p>I've used ejs template engine. Here is the code of the &quot;pdf.ejs&quot; file which I rendered in the before mentioned route.</p>
  <pre><code>&lt;div class=&quot;container&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
          &lt;div class=&quot;col-md-4&quot;&gt;
              &lt;img class=&quot;card-img-top&quot;  src=&quot;&lt;%= output.newspapers[0].logo %&gt;&quot;&gt; 
              &lt;h1&gt;&lt;%= output.newspapers[0].newsPaperName %&gt;&lt;/h1&gt;
          &lt;/div&gt;
          &lt;div class=&quot;text-center&quot;&gt;
              &lt;img class=&quot;img-fluid&quot; id=&quot;test&quot; src=&quot;&lt;%= output.image %&gt;&quot; alt=&quot;&quot;&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hxoOp.png" rel="nofollow noreferrer">Here is the screenshot of my application, which failed to render the dynamic image path</a></p>
  <p><a href="https://i.stack.imgur.com/trNZg.png" rel="nofollow noreferrer">Here, I've also included a screenshot of the sample JSON data, in which the path of the images is included</a></p>