ChromeDevTools / devtools-protocol

Chrome DevTools Protocol
https://chromedevtools.github.io/devtools-protocol/
BSD 3-Clause "New" or "Revised" License
1.15k stars 226 forks source link

printToPDF - Japanese output in pdf with Chinese font #136

Closed kingsleyarchibald closed 5 years ago

kingsleyarchibald commented 5 years ago

printToPDF - Japanese output in pdf with Chinese font

Dear sir/ms,

I am trying to use the puppeteer nodejs module to convert html files with Japanese text in them into pdf format. Everything works, except that the outputted pdf file is in a Chinese font rather than Japanese. For most characters, it is hard to tell the difference, but one character for which the difference is clear is "直" (see attached files for how it is displayed in the Chinese font: chinese font

I have tried debugging the issue in the puppeteer code, but it seems that they are simply calling Page.printToPDF(). When I use the headless: false option for puppeteer.launch(), I can see that the original html file displays the Japanese characters as expected, but the Chinese font is displayed in the output of the pdf() function. (the same is true for the screenshot() function)

puppeteer version: 1.11.0 nodejs version: v8.11.4 Windows 10 pro, x64

I apologize for troubling you if this is not the appropriate place to report this issues.

Best regards

aslushnikov commented 5 years ago

Hey @kingsleyarchibald,

The right place to file PDF issues is upstream to Chromium: https://crbug.com/new Chromium's PDF team might be able to help there.

I'll close this for now, but please feel free to post the link to the upstream bug here for the future reference.

kingsleyarchibald commented 5 years ago

thank you for the guidance aslushnikov

kingsleyarchibald commented 5 years ago

Here's the link: https://bugs.chromium.org/p/chromium/issues/detail?id=916816

They gave me a workaround, but seemed to think that the language setting was somehow getting lost when converting to a PDF with puppeteer.

Thanks again for you help