#StackBounty: #puppeteer #google-chrome-headless #pyppeteer #printtopdf Emoji convered to greyed out in PDF output from Chrome Headless

Bounty: 100

(Note, even though this mention Pyppeteer, the Python version of Puppeteer, the code is exactly the same and works with either Puppeteer and Pyppeeteer).


I’m converting the page http://getemoji.com/ into PDF using the following code :

import asyncio
from pyppeteer import launch
from pyppeteer.launcher import connect

async def main():
    browser = await launch()
    context = await browser.createIncognitoBrowserContext()
    page = await context.newPage()
    page.on('dialog', lambda dialog: dialog.dismiss())
    # await page.emulateMedia('print')
    await page.goto('http://getemoji.com/')
    await page.screenshot({'path': 'example.png'})
    await context.close()
    await browser.disconnect()


And it generates properly the following image:
enter image description here

But if I try to convert the page into PDF, like this:

    await page.pdf({
        'path': 'example.pdf',
        'format': 'A4'

All the emoticons are greyed in the resulting PDF, like this:

enter image description here

The issue is not a font issue with the emoji, since they work perfectly on the screenshot. It’s something related to how the PDF is generated, but I can’t find out why.

I’m hoping you’ll find it 🙂

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.