New issue
Advanced search Search tips

Issue 852652 link

Starred by 3 users

Issue metadata

Status: Untriaged
Merged: issue 774970
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Low quality PDF text rendering on Headless Chrome

Reported by ja...@inkdigital.com.au, Jun 14 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134

Steps to reproduce the problem:
Open Chrome with --headless, --print-to-pdf on any webpage. An example demonstrating this behaviour in sample.html is attached.

What is the expected behavior?
Text should have even spacing such as in the PDF's and screenshots provided under the Chrome browser on Windows and WKHTMLtoPDF.

What went wrong?
Letters have too much or too little spacing in between them, as demonstrated in the supplied PDF and screenshot from Headless Chrome.

Did this work before? No 

Chrome version: 69.0.3452.0  Channel: dev
OS Version: 3.10.0-862
Flash Version: N/A

I am using CentOS 7.4, but this also occurs on 7.5. Chrome is running using Puppeteer 1.5.0 and Browsershot 3.22.1. I have not been able to find a workaround despite experimenting with Puppeteer and Browsershot's options. Additionally, I attempted to add a configuration file specifying better rendering conditions in /etc/fonts/conf.d with no success.
 
Chrome browser Windows.pdf
8.0 KB Download
Chrome-browser-Windows.png
19.7 KB View Download
Headless Chrome Linux.pdf
8.0 KB Download
Headless Chrome Linux.png
20.3 KB View Download
layout.css
200 bytes View Download
sample.html
610 bytes View Download
WKHTMLtoPDF.pdf
6.6 KB Download
WKHTMLtoPDF.png
31.7 KB View Download
Labels: Needs-Triage-M69

Comment 2 by l...@chromium.org, Jun 14 2018

Components: -Platform>DevTools Internals>Headless
Reproduced on a fresh install of Ubuntu 18.04 (Linux kernel 4.15.0-1010) and the same version of Chrome. Output attached.
Headless Chrome Ubuntu 18.04.pdf
7.6 KB Download
Headless Chrome Ubuntu 18.04.png
20.0 KB View Download
My tests labeled as "Headless Chrome" above, as mentioned in the original post, are running through Browsershot, a PHP frontend for the Puppeteer API. So I could be certain neither of these were interfering, I repeated the scenario on the new Ubuntu VM exclusively using Chrome's executable in headless mode using the following command:

sudo ./chrome --headless --print-to-pdf --no-sandbox https://example.com/sample.html

I needed to modify the test case slightly to avoid the text disappearing. This meant calling the Source Sans Pro Google font CSS locally instead of remotely. Once again, I was able to reproduce the bug.

As a control, I duplicated the same text without using an external font. Peculiarly, the default font renders with no issues at all.

Please see the below files.
sample.html
1.0 KB View Download
layout.css
272 bytes View Download
fonts.css
10.2 KB View Download
Headless Chrome raw.pdf
33.2 KB Download
Headless Chrome raw.png
38.4 KB View Download
Cc: phanindra.mandapaka@chromium.org
Labels: Triaged-ET
Mergedinto: 774970
Status: Duplicate (was: Unconfirmed)
This issue seems similar to Issue 774970, hence merging into it and marking it as Duplicate.
Note: Feel free to UN-dupe it if not the case.

Thanks!
Hi there Phanindra,

I think there's been a misunderstanding. Issue 774970 concerns images disappearing when they run off the bottom of a PDF page. This issue describes how text spacing is inconsistent in any location on PDF's. Furthermore, I do not have bug editing privileges, so I am not able to undo this mistake. Can you please rectify this mix-up as soon as possible?
Additional tests I've attempted using CSS properties of text-rendering and font-smoothing do not fix the problem. However, I confirmed that Headless Chrome on Windows does not encounter this issue. I've attached the output PDF. The command I used follows.

chrome --headless --print-to-pdf https://example.com/sample.html

I should note that there is a typo in calling the Source Sans Pro CSS in the previous attachments. The uploaded filename is fonts.css when it should be font-ssp instead.
Headless Chrome Windows.pdf
76.6 KB Download
Cc: schenney@chromium.org
Status: Untriaged (was: Duplicate)
un-duping as requested.

Sign in to add a comment