html – My Code has PDF Cut off issue I want to fix it

This is my the code :

This code has PDF cut off Issue.

export async function htmlToPdfImpl(html: any, pdfName: string): Promise<void> {
    await (async () => {
        const browser = await puppeteer.launch();
        const page = await browser.newPage();
        await page.setContent(html);
        await page.evaluateHandle('document.fonts.ready');

        await page.pdf({
            path: `pdf/$pdfName}.pdf`,
            format: 'A4',
            printBackground: true,
            behavior: 'allow',
            downloadPath: './',
            margin: {top: '0.25in', right: '0.25in', bottom: '0.25in', left: '0.25in'}
        });

        await browser.close();

    })();

}

htmlToPdfImpl async function has Two parameter like html ans pdfname. you want to pass html content to html parameter and you can pass you want any name for pdfName parameter.

Important : Before use above code you want to Install bellow things and Import.

Install: –

npm i puppeteer

Import:-

const puppeteer = require('puppeteer');
const fs = require("fs");

If you have any better solution to fixed the above issue let me know.