The pdf
method takes a single argument: a file-path (absolute) of where to save the pdf. If no file-path is provided it will return a buffer of base64 encoded data.
JavaScript
const { Chrome } = require('navalia');
const chrome = new Chrome();
const filepath = process.cwd() + 'google.pdf';
chrome.goto('https://www.google.com')
.then(() => chrome.pdf(filepath))
.then(() => chrome.done());
TypeScript
import { Chrome } from 'navalia';
const chrome = new Chrome();
const filepath = process.cwd() + 'google.pdf';
async function pdf() {
await chrome.goto('https://www.google.com');
await chrome.pdf(filepath);
chrome.done();
}
pdf();