Hi,
Using pdfmake@^0.1.58, with svg-to-pdfkit installed (as per documentation), I'm getting this:
Uncaught Error: Please install svg-to-pdfkit to enable svg nodes
at getSvgToPDF (pdfmake.js:18787)
at renderSVG (pdfmake.js:19365)
at renderPages (pdfmake.js:19143)
at PdfPrinter.createPdfKitDocument (pdfmake.js:18908)
at Document._createDoc (pdfmake.js:18310)
at Document.getBuffer (pdfmake.js:18472)
at Document.getBlob (pdfmake.js:18462)
at pdf.js:215
I'm generating the PDFs on the client (in browser), with the following import:
import pdfMake from 'pdfmake/build/pdfmake';
Looking inside that file, I see the following built code:
var getSvgToPDF = function () {
try {
// optional dependency to support svg nodes
return __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'svg-to-pdfkit'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
} catch (e) {
throw new Error('Please install svg-to-pdfkit to enable svg nodes');
}
};
Doesn't the lib need a rebuild?
Indeed a new build is needed. For now you can go with your terminal to the designated node_modules/pdfmake folder and run:
npm install
gulp build
Hello,
Wondering when the new build to support svg-to-pdfkit will be created?
I've put up a simple fork with the rebuild after installing svg-to-pdfkit in it here: https://github.com/jkoudys/pdfmake
install "pdfmake": "[email protected]:jkoudys/pdfmake.git", to get 1.58 w/ svg support on the client side.
Most helpful comment
Indeed a new build is needed. For now you can go with your terminal to the designated node_modules/pdfmake folder and run: