Here is my result.ejs file code:
<div style="width: 50%; margin: auto;">
<table class="table">
<thead>
<tr>
<th>SUBJECT</th>
<th>MARKS OBTAINED</th>
</tr>
</thead>
<tbody>
<tr>
<th>pHYSICS</th>
<td>80</td>
</tr>
<tr>
<th>Chemistry</th>
<td>80</td>
</tr>
<tr>
<th>mathematics</th>
<td>80</td>
</tr>
<tr>
<th>computer</th>
<td>80</td>
</tr>
</tbody>
</table>
</div>
In my user.js, I am rendring ejs file:
router.get("/result",async(req,res)=>{
res.render("result");
})
I know basics about pdfkit. But I have used it for printing text only in pdf format like below:
const PDFDocument = require('pdfkit');
const fs = require('fs');
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('output.pdf'));
doc
.fontSize(25)
.text('Some text with an embedded font!', 100, 100);
But Now I need to print ejs file table data in pdf format. Please help me to find out. Thank you.