我正在使用wkhtmltopdf版本0.12.2.1 (带有修补的qt)来渲染我的reactJs应用程序!它运行得很好,直到我添加了react-pdf-js库来渲染在我的应用程序中生成的pdf。我遵循了react-pdf-js文档中描述的代码(请参阅https://www.npmjs.com/package/react-pdf-js)来使其工作。
pdf是在我的页面中呈现的,它看起来确实很酷。但是,当我再次尝试运行wkhtmltopdf,以生成我的应用程序的任何页面的pdf时,返回以下错误:
desenv01@desenv01-PC:~$ wkhtmltopdf -O Landscape --print-media-type --debug-javascript http://localhost:3000/report/1 report.pdfLoading pages (1/6)
Warning: undefined:0 ReferenceError: Can't find variable: Float64Array
Warning: http://localhost:3000/assets/js/app.js:46789 SyntaxError: Parse error
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done然后,我转到我的app.js查看46789行上的内容:
set href(href) {
clear.call(this);
parse.call(this, href);
},
get protocol() {
return this._scheme + ':';
},
set protocol(protocol) {
if (this._isInvalid)
return;
parse.call(this, protocol + ':', 'scheme start');
},错误发生在pdf.combined.js脚本中的parse.call(this, href);行上。
我在网上找不到任何解决方案,所以我想知道是否有人知道我做错了什么,或者有办法解决它。
谢谢..
发布于 2017-06-10 03:44:17
我在使用wkthmltopdf 12.3和12.4时遇到了这个问题,因为我的集成开发环境设置为纠缠我使用var而不是let。问题是驱动这些版本程序的旧Qt引擎不能识别新风格的ES6关键字。不确定是否可以向下转换React。否则,您可以尝试使用较新的Qt的前沿版本。
https://stackoverflow.com/questions/37351718
复制相似问题