Sha256: 11f5b1daf1f4c441314def57b8861d974425e8a2d0d57c7de141ef84bf8ff336

Contents?: true

Size: 835 Bytes

Versions: 8

Compression:

Stored size: 835 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.configure(page, configuration.userOptions);
        await dhalang.navigate(page, configuration);
        const pdfOptions = await dhalang.getConfiguredPdfOptions(page, configuration);
        await page.pdf({
            ...{
                path: configuration.tempFilePath
            },
            ...pdfOptions
        });
    } catch (error) {
        console.error(error.message);
        process.exit(1);
    } finally {
        if (browser) {
            browser.close();
        }
        process.exit();
    }
};
createPdf();

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
Dhalang-0.7.0 lib/js/pdf-generator.js
Dhalang-0.6.6 lib/js/pdf-generator.js
Dhalang-0.6.5 lib/js/pdf-generator.js
Dhalang-0.6.4 lib/js/pdf-generator.js
Dhalang-0.6.3 lib/js/pdf-generator.js
Dhalang-0.6.2 lib/js/pdf-generator.js
Dhalang-0.6.1 lib/js/pdf-generator.js
Dhalang-0.6.0 lib/js/pdf-generator.js