pyppeteer pdf generation is getting killed when being downloaded

79 Views Asked by At

with the following code, I am using pyppeteer to generate the pdf

async def generate_pdf_with_pyppeteer(self, temp_file_name, file_name):
        from pyppeteer import launch
        browser = await launch({
            'headless': True,
            'handleSIGINT': False,
            'handleSIGTERM': False,
            'handleSIGHUP': False,
            'args': [  '--no-sandbox', '--font-render-hinting=none' ]
        })
        page = await browser.newPage()
        await page.setViewport({'width': 595, 'height': 1024})
        await page.goto('file://'+temp_file_name)
        # Calculate Height of the Web Page
        metrics = await page._client.send('Page.getLayoutMetrics')
        height = math.ceil(metrics['contentSize']['height'])

        await page.pdf({"path": file_name, "width": 1024, "height": height, "pageRanges": "1", "printBackground": True})
        await browser.close()

When the pdf is being generated, its showing the following error. Can someone help to debug this?

enter image description here

0

There are 0 best solutions below