puppeteer: [Bug]: Missing some emojis when printing
Minimal, reproducible example
const puppeteer = require("puppeteer");
const path = require("path");
const filePath = path.resolve(__dirname, "index.html");
(async () => {
try {
const browser = await puppeteer.launch({
headless: 'new', // Use true to run headless, not 'new'
args: [
"--no-sandbox",
"--disable-setuid-sandbox",
"--font-render-hinting=medium",
],
});
const page = await browser.newPage();
await page.goto(`file:///${filePath}`, {
waitUntil: "networkidle0",
});
await page.emulateMediaType('print')
await page.pdf({
path: "GAUTHEY_Mathis.pdf",
format: "A4",
printBackground: false, // Change to true if you want to include background
displayHeaderFooter: false,
margin: { top: 0, right: 0, bottom: 0, left: 0 },
preferCSSPageSize: true,
});
await browser.close();
console.log("✅ PDF built");
} catch (error) {
console.error("❌ Error building PDF:", error);
process.exit(1);
}
})();
Error string
no error
Bug behavior
- Flaky
Background
Hi there ! I’m using jsonresume to build my resume while using the one-page theme.
Everything works fine, my HTML file is building properly, the basic PDF export from jsonresume is ugly.
So I decided to use my own Puppeteer script to print my pdf using chrome in headless mode.
Expectation
This is the result I get by using firefox and print using the system dialog.
Reality
This is the result I get using Puppeteer.
If I take an emoji from the Interest or the Language section, and put it in the Work, Skill or Education section, the emoji isn’t showing.
If I take an emoji from one of the section that doesn’t render the emoji and add it to either Language or Interest section, it does work.
I’m working inside WSL if that matters.
Thins I’ve tried :
- Installing chrome and all the dependencies that are inside the troubleshooting page
- Installed and reinstalled many different emoji styling for ubuntu. At the very beginning I had no emoji working, it allowed me to make the bottom sections work.
- Using headless false, background true and other different solutions found online. None worked.
Puppeteer configuration file (if used)
No response
Puppeteer version
21.3.8
Node version
20.7.0
Package manager
npm
Package manager version
10.1.0
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 15 (1 by maintainers)
I am gonna close this issue since it’s not directly addressable in Puppeteer. If it still happens with the latest Chrome versions, please file a bug for Chrome at crbug.com/new.
Please note that for Firefox you cannot use
networkIdle0
in combination withPage.goto()
. Maybe you missed that in my former comment.Otherwise lets leave the issue for @jrandolf to get the issue fixed for Chrome.
Not with Chrome but with Firefox.
It works fine for me with both the CDP and WebDriver Bidi protocol. It should work with Firefox when having code like that:
@whimboo PTAL