问题
I'm using jspdf to render HTML to PDF in an Ember app. jspdf is included using the ember-js-pdf plugin, which is getting me jspdf v1.5.3. html2canvas seems to have recently moved to a promise-based model which jspdf isn't ready for, so I tried rasterizeHTML.js instead. Once I made it available in the app by adding
app.import('node_modules/rasterizehtml/dist/rasterizeHTML.js');
I'm able to build, but then when I print I get this error:
Uncaught TypeError: Cannot read property 'inlineReferences' of undefined
at Object.module.rasterize (rasterizeHTML.js:1009)
at Object.module.drawDocument (rasterizeHTML.js:1081)
at Object.jsPDFAPI.addHTML (jspdf.debug.js:15833)
...and at that point, uh?
It looks like rasterizeHTML is looking for any inline assets to retrieve and include, and not finding any? Is this a bug in rasterizeHTML?
ETA: This may be a duplicate of jsPDF + rasterizeHTML not working? but that question doesn't provide much detail on its errors, so I can't tell if it's the same problem.
来源:https://stackoverflow.com/questions/56259199/cannot-read-property-inlinereference-of-undefined-in-rasterizehtml-from-jspdf