I'm new to express.js and I'm working on my first project.
I'm trying to generate a PDF of my EJS file.
Simple EJS -> PDF is working fine.
But I want to use some variables in the EJS file. I want this:
Data -> EJS -> PDF
Problem: EJS is not rendering the passed value.
I'm using EJS as the template engine and express-pdf to generate PDF.
The code is:
app.use('/getResume/:id', function(req, res){
var id = req.params.id;
var data = ejs.render(path.join(__dirname, './pages/resume/CV' + id + '.ejs'), {name: "Faheem"});
res.pdfFromHTML({
filename: 'myPDF.pdf',
html: data,
options: {
base : 'file:///C:/nLab/resume/',
format: "A4",
margin: '0cm',
}
});
});
What am I doing wrong? Thanks
via Faheem
No comments:
Post a Comment