New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 833058 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Last visit 28 days ago
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

The same font size is rendered differently in main part and headerTemplate while printToPDF in headless mode

Reported by s.ple...@gmail.com, Apr 14 2018

Issue description

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

Steps to reproduce the problem:
1. I use puppeteer @1.3.0 and chrome @68.0.3398.0
2. Generate PDF 

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    const content = '<h1 style="font-size:20px;margin: 0;">First <span style="background: yellow">second</span> third</h1>'; 

    try {
        await page.setContent(content);
        await page.pdf({
            displayHeaderFooter: true,
            path: 'size_bug.pdf',
            printBackground: true,
            headerTemplate: content,
            margin: {
              top: '60px'
            }
        });
    } catch (e) {
        console.error(`Something went wrong: ${e.message}`);
    } finally {
        await browser.close();
    }
})();

What is the expected behavior?
Font size should be the same in header and in main content.

What went wrong?
The font size is 20 in header and 15 in main content in spite of html font-size:'20px'

Did this work before? No 

Chrome version: 68.0.3398.0  Channel: dev
OS Version: 10.0
Flash Version:
 
size_bug.pdf
77.9 KB Download
2018-04-14_1427.png
22.5 KB View Download
Labels: Needs-Triage-M68
Owner: pfeldman@chromium.org
Status: Assigned (was: Unconfirmed)
I can confirm I can replicate the issue. A workaround is to apply a CSS 3 transformation of 0.75 on the font.
Images, however, have the right dimensions.
Owner: lushnikov@chromium.org

Sign in to add a comment