As we can verify by copying/pasting the following html
on the following w3schools.com link that it highlights the word highlighted
with yellow background
, and the word test
with red foreground
. But, as shown in the image below, when you print this html page with Window.Print()
command, it does not print the yellow background of the word highlighted
. Question: Is there a workaround to make Window.Print()
method work for highlighted text, as well?
<!DOCTYPE html>
<html>
<body>
<h2>The window.print() Method</h2>
<p>Click the button to print the current page.</p>
<p>This is a <span style='background:yellow;'> highlighted</span> text. And <span style='color:red;'>test</span> for font color.</p>
<button onclick="window.print()">Print this page</button>
</body>
</html>
snapshot in Windows 10 of Print to PDF
preview of the above html