File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ interface InvoiceDetailsProps {
3333 value : string | number ;
3434}
3535
36+ /** Styles injected into the print iframe that react-to-print builds. */
37+ const printPageStyle = `
38+ @page {
39+ /* Remove the browser's default header (title) and footer (url) */
40+ margin: 0;
41+ }
42+
43+ @media print {
44+ html,
45+ body {
46+ display: block !important;
47+ background-color: #ffffff !important;
48+ /* Tell browsers to print background colors */
49+ color-adjust: exact;
50+ print-color-adjust: exact;
51+ -webkit-print-color-adjust: exact;
52+ }
53+ }
54+ ` ;
55+
3656const Invoice : React . FC = ( ) => {
3757 const { t } = useTranslation ( ) ;
3858 const { data } = useDefaultFacility ( ) ;
@@ -135,6 +155,7 @@ const Invoice: React.FC = () => {
135155 const handlePrint = useReactToPrint ( {
136156 contentRef : componentRef ,
137157 documentTitle : `Invoice ${ bill ?. receiptNumber } - ${ patient ?. name ?. [ 0 ] ?. given ?. join ( ' ' ) } ${ patient ?. name ?. [ 0 ] . family } ` ,
158+ pageStyle : printPageStyle ,
138159 onBeforePrint : handleOnBeforeGetContent ,
139160 onAfterPrint : handleAfterPrint ,
140161 preserveAfterPrint : false ,
Original file line number Diff line number Diff line change 9898 display : block !important ;
9999 }
100100}
101-
102- @media print {
103- html ,
104- body {
105- display : block !important ;
106- background-color : colors .$white !important ;
107- }
108- }
You can’t perform that action at this time.
0 commit comments