Sha256: 2fbcde6e754ffd6c53872282c7561b2a5f42d181bf4d324291fcd0f6b0c935ce

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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