[R] datatable using dt not able to print background colors

Matthew Pirritano MP|rr|t@no @end|ng |rom |@c@re@org
Sat Dec 17 01:20:47 CET 2022

Hey, all!

I've got a report that uses datatable from DT to create an rmarkdown html that looks great as an html but when I try to print it, to a printer, or to a pdf the colors I've assigned to cells are not displaying. I'm using chrome and I've clicked on the Background graphics button there, but that doesn't help print the colors. I have tried to run the datatable section of the code using results = 'asis' and eliminating results = 'asis'. Neither seems to help with the

My css style at the top of the rmarkdown is

<style type="text/css">
.main-container {
  max-width: 1500px;
  margin-left: auto;
  margin-right: auto;
  table.display td { white-space: wrap; }

  -webkit-print-color-adjust:exact !important;
  print-color-adjust:exact !important;

I added the webkit bit based on what I've found online. Maybe I have something set up incorrectly there? Any ideas or thoughts on how to get this to print the background colors?



This communication is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and delete any copies. Thank you.

	[[alternative HTML version deleted]]

More information about the R-help mailing list