christopherdro / react-native-html-to-pdf

Convert html strings to PDF documents using React Native
MIT License
434 stars 264 forks source link

CSS `background-color` and `background` property doesn't work on iOS #308

Closed Chr1ssW closed 5 months ago

Chr1ssW commented 7 months ago

The background-color and background properties do not work on iOS, but they render fine on Android. When decoded, the returned base64 string also doesn't contain the colors. See the examples below:

.invoice-box table tr.heading td {
    background: #eee;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

iOS

image

Android

image

one-god commented 6 months ago

I am facing the same issue ,background-image not work on iOS

jole141 commented 6 months ago

@Chr1ssW @one-god This solved the problem for me

<style>
      * { print-color-adjust:exact !important; }
</style>
one-god commented 6 months ago

@Chr1ssW @one-god This solved the problem for me

<style>
      * { print-color-adjust:exact !important; }
</style>

thank you so much,it's OK now

Chr1ssW commented 5 months ago

This solution indeed works, closing the issue. Thanks to @one-god for the solution!

okechukwu0127 commented 3 months ago

this worked like a charm for me for ios