Rename Page.printToPDF into page.pdf

This patch:
- renames Page.printToPDF into page.pdf
- adds a 'path' option to the page.pdf options instead of a separate
  `filePath` parameter
- improves on the documentation for the `page.pdf`

References #39.
This commit is contained in:
Andrey Lushnikov
2017-07-17 02:06:52 -07:00
parent 3b5dbe2308
commit b2d2bf822a
5 changed files with 58 additions and 25 deletions

View File

@@ -829,7 +829,7 @@ describe('Puppeteer', function() {
}));
});
describe('Page.printToPDF', function() {
describe('Page.pdf', function() {
let outputFile = __dirname + '/assets/output.pdf';
afterEach(function() {
fs.unlinkSync(outputFile);
@@ -837,7 +837,7 @@ describe('Puppeteer', function() {
it('should print to pdf', SX(async function() {
await page.navigate(PREFIX + '/grid.html');
await page.printToPDF(outputFile);
await page.pdf({path: outputFile});
expect(fs.readFileSync(outputFile).byteLength).toBeGreaterThan(0);
}));
});