Skip to content Skip to sidebar Skip to footer

Css Issues With Html-pdf

I want to use html-pdf to save a quote made with sails, .ejs, and angular into a pdf to send it to the customer. An .ejs file (view folder) and its assign .js controller (assets fo

Solution 1:

I can help you out with your first issue. "@media print" is a CSS tag that applies only when a document is sent to be printed, basically what you can see on your print preview on your browser. The PDFs created by html-pdf are considered like that, as a printable document rather than an HTML document.

I fixed this by going to the bootstrap.css file and manually edit it myself. You just need to find the @media print tag that has a "*" tag right below it.

It looks like this:

@media print {
*,
*:before,
*:after {
    color: #000!important;
    text-shadow: none !important;
    background: transparent !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
}
...

There, you can see that it sets the background-color and color as !important to the whole document. Remove the universal (*) tags and you'll be able to use your own custom CSS for backgrounds and font-colors.

Post a Comment for "Css Issues With Html-pdf"