I am using PuppeteerSharp(ver 18.0.5.0) to generate webPage to PDF.
This is my WebPage view ⬇
WebPage view
After using Puppeteer to download, this is what my PDF file shows ⬇
PDF file view
Here is my PdfOptions setting
await page.PdfAsync(pdfPath, new PdfOptions
{
Format = PaperFormat.A4,
PrintBackground = true,
PreferCSSPageSize = true,
});
And below is css setting.
@media print {
@page {
margin: 22mm 15mm 35mm 15mm;
background-color: teal !important;
}
html, body, #content, #header, #footer, .page {
background-color: teal !important;
-webkit-print-color-adjust: exact !important;
}
}
I have been setting PrintBackground attr, and setting css, but none of these are working.