私はreactJsアプリケーションをレンダリングするためにwkhtmltopdfバージョン0.12.2.1(パッチ付きqt付き)を使用しています!私のアプリケーション内で生成されたPDFをレンダリングするためにreact-pdf-js
のlibを追加するまで、うまくいきました。私はreact-pdf-jsのドキュメント(https://www.npmjs.com/package/react-pdf-jsを参照)に記述されているコードを使って動作させました。SyntaxError:構文解析エラー - react-pdf-jsライブラリを使用したWkhtmltopdf
pdfは私のページの中にレンダリングされていて、本当にかっこいいですね。しかし、私は私のアプリの任意のページのPDFを生成するために、もう一度wkhtmltopdfを実行しようとすると、次のエラーが返されます。次に
[email protected]:~$ 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
、私はライン46789上にあるものを見るために私のapp.jsに行ってきました:
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);
を言う行に発生します。
オンラインで解決策を見つけることができなかったので、何か間違っているかどうかを知っている人がいるかどうか、それを回避する方法があるのだろうかと疑問に思った。
おかげ..
[Debugging javascript with wkhtmltopdf](http://stackoverflow.com/questions/17151755/debugging-javascript-in-wkhtmltopdf)の可能な複製 –