Sha256: 0e7c7bac1a35343a9636ce8afcb054435b344e77bda0a9a245e1a14646a786cc

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

'use strict';
const dhalang = require('./dhalang');

const createPdf = async () => {
    const configuration = dhalang.getConfiguration();

    let browser;
    try {
        browser = await dhalang.launchPuppeteer(configuration);
        const page = await browser.newPage();
        await dhalang.configurePage(page, configuration.userOptions);
        await page.goto(configuration.webPageUrl, dhalang.getNavigationParameters(configuration));
        await page.waitForTimeout(250);
        await page.pdf({
            ...{
                path: configuration.tempFilePath
            },
            ...configuration.pdfOptions
        });
    } catch (error) {
        console.error(error.message);
        process.exit(1);
    } finally {
        if (browser) {
            browser.close();
        }
        process.exit();
    }
};
createPdf();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Dhalang-0.5.0 lib/js/pdf-generator.js