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

Issue 836219 link

Starred by 6 users

Issue metadata

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



Sign in to add a comment

External style sheets are added by link is not applied in headerTemplate while printToPDF in headless mode

Reported by dzmitry....@gmail.com, Apr 24 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

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

File ./style.css:
p { color: red; }

const puppeteer = require('puppeteer');

(async () => {
    const content = '<html><head><link rel="stylesheet" href="style.css"></head><body><p style="font-size: 20px">Test</p></body></html>';

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

What is the expected behavior?
External style sheets are added by a link (<link rel="stylesheet" href="style.css">) should be applied to HTML content in header.

What went wrong?
External style sheets are added by a link (<link rel="stylesheet" href="style.css">) is not applied applied to HTML content in header.

Did this work before? No 

Chrome version: 65.0.3325.181  Channel: n/a
OS Version: OS X 10.13.3
Flash Version:
 
css_bug.pdf
42.1 KB Download
Screen.png
14.7 KB View Download
Labels: Needs-Triage-M65
Labels: Triaged-ET TE-NeedsTriageHelp
The issue seems to be out of Te-scope as it is related to puppeteer automation tool. Hence, adding label TE-NeedsTriageHelp for further investigation from dev team.

Thanks...!!
Owner: lushnikov@chromium.org
Status: Assigned (was: Unconfirmed)

Sign in to add a comment