Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i print a web page (say a div of contents with styles, images and table of data) using javascript.

What I have tried:

using window.print() didn't worked well. Didn't print images and styles as it is in web page.
Posted
Updated 17-Apr-18 21:28pm

1 solution

Hello,

You must have to write set of css rules or class inside the @media print.
CSS
@media print {
    body {
        -webkit-print-color-adjust: exact;
    }
    .other-classes-comes-here {
    }
}
 
Share this answer
 
Comments
Member 13784881 18-Apr-18 14:50pm    
Hi sunasara, thanks for the reply. Not sure, where am i missing and for some reason the suggestion you have given isn't working for mine. If you have a example. can you help me provide me please.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900