Xportability / css-to-pdf

Convert any HTML page or region to PDF - supports CSS, SVG, embedded XML objects, and more..
http://www.cloudformatter.com/CSS2Pdf
207 stars 77 forks source link

Background-color not transferring to PDF #47

Closed melneff closed 8 years ago

melneff commented 8 years ago

I have an div that I'm transferring to pdf but I cannot get the background-color to transfer in a th. Other things transfer fine, but if I set the background-color or color of the th it will not show up on the pdf.

thead style="background-color:red;"

do I have to set something else first to get this to transfer?

kbrown01 commented 8 years ago

what is thead? I do not quite understand your example. Do you mean "th style=.."

kbrown01 commented 8 years ago

Like this: http://jsfiddle.net/zvx6eb7e/266/

kbrown01 commented 8 years ago

Or this if you are trying to do the whole header ... http://jsfiddle.net/zvx6eb7e/269/

kbrown01 commented 8 years ago

Or this works too using thead element ... http://jsfiddle.net/zvx6eb7e/271/

kbrown01 commented 8 years ago

One thing to check is your @media print rules. If you are using some default rules in some library or of the browser, there are many times that these rules turn off background-color and many other things. We are applying all @media print rules that you do not exclude so it is possible such a rule exists somewhere in your CSS and it is being applied.

melneff commented 8 years ago

Hello, I found my issue from looking at the jsfiddles.

thanks!

On Thu, Sep 29, 2016 at 4:52 PM, kbrown01 notifications@github.com wrote:

Or this works too using thead element ... http://jsfiddle.net/zvx6eb7e/ 271/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Xportability/css-to-pdf/issues/47#issuecomment-250624274, or mute the thread https://github.com/notifications/unsubscribe-auth/AIReS906L4vtpE2QT1fCF2wkzaABULyKks5qvE9KgaJpZM4KKlLH .

kbrown01 commented 8 years ago

Perfect! Closing.