I am trying to use pdfmake on server-side following these instructions https://pdfmake.github.io/docs/0.1/getting-started/server-side/
What I've done is:
I run npm install pdfmake
I download the pdfmake.js and vfs_fonts.js libs and place them in the the project file
I add the basic html and javascript needed and my code looks like this
<html>
<head>
<script src='test\libs\pdfmake.js'></script>
<script src='test\libs\vfs_fonts.js'></script>
<meta charset="utf-8">
</head>
<body>
<div class="col-md-4 col-md-offset-8 ">
<button id="download_pdf" onclick="downloadfunction()" download>Download Button</button>
</div>
</body>
<script>
function downloadfunction() {
var docDefinition = {
content: [
{text: "Hello"}
]
};
pdfMake.createPdf(docDefinition).open();
};
</script>
</html>
- but when I run it, I get this error: Uncaught ReferenceError: pdfMake is not defined
Why the pdfMake is not recognized? Am I missing any step?
Also, when I include the libs like this:
<script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.70/pdfmake.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.70/vfs_fonts.js'></script>
it works, but I want to do it offline and get the libs directly from my project
Thank you!