When it comes to creating a pdf with custom styling using CSS, I'm encountering an issue where the background-color doesn't display as expected. Despite my efforts, I can't seem to achieve a full background effect.
Here's the CSS code I'm working with:
@media print {
@page {
background: pink !important; // not displaying
margin: 0 !important;
padding: 0 !important;
-webkit-print-color-adjust: exact !important;
}
}
html, body {
box-sizing: border-box;
min-height: 100%;
min-width: 100%;
height: 100%;
width: 100%;
font-family: Montserrat;
background-color: #20333e;
color: rgba(255, 255, 255, 0.87);
border: 2px solid red;
}
This setup results in the following output:
https://i.sstatic.net/1gRJO.png
Currently, I have all the markdown data stored in json format and I am utilizing the markdown-pdf package to generate the pdf file.
import * as markdownpdf from 'markdown-pdf';
markdownpdf({cssPath: './path/to/my/ebook.css'}).from.string('# CSS Not Full Background').to("./document.pdf", function () {
console.log("done");
});
I'm seeking guidance on how to adjust my styling to ensure that the pdf has a complete background coverage. Any suggestions?