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

Issue 836189 link

Starred by 6 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

The background color is not rendered 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:
1. I use puppeteer @1.3.0 and chrome @65.0.3325.181
2. Generate PDF 

const puppeteer = require('puppeteer');

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

    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    try {
        await page.setContent(content);
        await page.pdf({
            displayHeaderFooter: true,
            path: 'background_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?
The background color should be rendered in a header.

What went wrong?
The background color is not rendered in a header.

Did this work before? No 

Chrome version: 65.0.3325.181  Channel: n/a
OS Version: OS X 10.13.3
Flash Version:
 
background_bug.pdf
46.9 KB Download
Screen.png
23.9 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...!!

Comment 3 by alph@chromium.org, May 14 2018

Cc: lushnikov@chromium.org
Components: -Platform>DevTools Internals>Plugins>PDF
Components: -Internals>Plugins>PDF
Status: Untriaged (was: Unconfirmed)
The pdf looks the same in Acrobat Reader, so not a PDF Viewer bug.

I don't have the context for Puppeteer, but if there is a bug, it's on the side of generated the PDF.
Screen Shot 2018-05-16 at 2.54.38 PM.png
383 KB View Download
Components: Internals>Headless
Mac triage: marking for Headless triage.

Sign in to add a comment