js window.print() prints the TD background color, the customer needs to add a light gray background color to the printed label fixed text, the page style is adjusted as follows: the
global CSS style is set as follows:
@media print {
body {
-webkit-print-color-adjust:exact;
-moz-print-color-adjust:exact;
-ms-print-color-adjust:exact;
print-color-adjust:exact;
}
}
Added !important to the style background-color attribute of the TD element
<tr>
<td height="15px" width="15%" colspan="2" align="center" style="background-color:#e0e0e0 !important"><strong>公司名称</strong></td>
<td colspan="3" width="35%" th:text="*{comName}"></td>
<td colspan="2" width="15%" align="center" style="background-color:#e0e0e0 !important"><strong>项目名称</strong></td>
<td colspan="2" width="35%" th:text="*{projectName}"></td>
</tr>