user3563459
user3563459

Reputation: 717

Unable to render color css property in PDF export using puppeteer

Tried to export html page in PDF using puppeteer library, however color css property not rendering in PDF.

Added below code in html

<style>
    html {
        -webkit-print-color-adjust: exact;
    }
    @media print {
        .highlightTxt {
            color: #f79747;
        }
    }
</style>

below code in js

await page.pdf({ path: `./download/${filename}`, format: 'A4', landscape: false, printBackground: true });

Upvotes: 0

Views: 608

Answers (1)

user3563459
user3563459

Reputation: 717

Added below and it is working fine.

html {
    -webkit-print-color-adjust: exact;
}
@media print {
    .highlightTxt {
        color: #f79747 !important;
    }
}

Upvotes: 1

Related Questions