savePDF
現在のブラウジングコンテキストのページをPDFファイルとしてOSに保存します。
Usage
browser.savePDF(filepath, { orientation, scale, background, width, height, top, bottom, left, right, shrinkToFit, pageRanges })
Parameters
| Name | Type | Details |
|---|---|---|
filepath | String | 生成されるPDFへのパス(.pdfサフィックスが必要)実行ディレクトリからの相対パス |
optionsoptional | PDFPrintOptions | PDF印刷オプション |
options.orientationoptional | String | PDFページの向き |
options.scaleoptional | number | PDFページの拡大縮小 |
options.backgroundoptional | boolean | PDFページの背景を含める |
options.widthoptional | number | PDFページの幅 |
options.heightoptional | number | PDFページの高さ |
options.topoptional | number | PDFページの上部パディング |
options.bottomoptional | number | PDFページの下部パディング |
options.leftoptional | number | PDFページの左側パディング |
options.rightoptional | number | PDFページの右側パディング |
options.shrinkToFitoptional | boolean | ページに合わせて縮小する |
options.pageRanges | object[] | PDFに含めるページ範囲 |
Example
savePDF.js
it('should save a PDF screenshot of the browser view', function () {
await browser.savePDF('./some/path/screenshot.pdf');
});
Returns
- <Buffer>
return: screenshot buffer