MatthewHerbst / react-to-print

Print React components in the browser. Supports Chrome, Safari, Firefox and EDGE
MIT License
2.06k stars 221 forks source link

Add dynamic colors to print function #692

Closed ratnabh closed 5 months ago

ratnabh commented 6 months ago

I tried not printing my footer and what i did was

const print = `
  @media print {
    footer {
      display: none;
    }
`;
 const handlePrint = useReactToPrint({
    content: () => componentRef.current,
    copyStyles: true,
    pageStyle: print,
  });

but what it did was it stopped printing the css colors used in my component Isn't there a way to preserve the configs and just update the print query for footer as the default configs were printing the css color unless i had to set footer to display null and change the default print function to my custom

Moreover it also stopped printing my images which were rendering in my component

MatthewHerbst commented 6 months ago

Hello. Could you explain your question/problem more clearly please? It's very hard to understand what you're asking. I don't see anything in the above code that would change colors.