ヘッドレスChromeでPDF印刷を試行しています。これは私が扱ってるのエラーです:ヘッドレスChromeでPrintToPDFが動作しない60
(node:6761) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: PrintToPDF is not implemented
Node.jsのパッケージ:
html-pdf-chrome
依存性:
✔ "chrome-remote-interface": "^0.23.1" (v0.23.2 installed)
✔ Chrome 59 (v60 beta installed)
ドライバースクリプト:
const htmlPdf = require('html-pdf-chrome');
const html = '<p>Hello, world!</p>';
const options = {
port: 9222, // port Chrome is listening on
};
htmlPdf.create(html, options).then((pdf) => pdf.toFile('test.pdf'));
クローム60ヘッドレスモードでインストールされ、実行されています。
> google-chrome --version
Google Chrome 60.0.3112.24 beta
私は、エラーが発生した場所であるPage.printToPDF
呼び出すコードセクションを突き止めました:
const CDP = require("chrome-remote-interface");
...
const { Page } = client;
...
// https://chromedevtools.github.io/debugger-protocol-viewer/tot/Page/#method-printToPDF
const pdf = yield Page.printToPDF(options.printOptions);
は私が必ずPage.captureScreenshot
のように他の広告を出して機能を実行することができています。
Page.printToPDF
を広告として掲載するにはどうすればよいですか?ここで