Cannot read property 'inlineReference' of undefined in rasterizeHTML from jspdf

走远了吗. 提交于 2020-01-16 17:08:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!