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 サフィックスが必要)実行ディレクトリからの相対パス |
options optional | PDFPrintOptions | PDF印刷オプション |
options.orientation optional | String | PDFページの向き |
options.scale optional | number | PDFページの拡大縮小 |
options.background optional | boolean | PDFページの背景を含める |
options.width optional | number | PDFページの幅 |
options.height optional | number | PDFページの高さ |
options.top optional | number | PDFページの上部パディング |
options.bottom optional | number | PDFページの下部パディング |
options.left optional | number | PDFページの左側パディング |
options.right optional | number | PDFページの右側パディング |
options.shrinkToFit optional | 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