Currently, I am working on an Angular project where I need to generate a printable document using CSS. The challenge I am facing is ensuring that the date and title in the header do not print automatically when the document spans multiple pages. Additionally, I want to set margins for the printed document. To tackle this issue, I have followed the guidance provided in this answer on Stack Overflow. However, I am encountering difficulties in applying the styling as intended.
In my CSS code, I have included the following:
@media print {
@page {
size: auto;
margin: 0;
}
body {
margin: 2cm !important;
}
}
I have attempted to incorporate this code into both the app.component.scss file and the styles.scss file, but neither approach seems to be effective. Any recommendations or insights on how to resolve this issue would be greatly appreciated?