I am facing an issue with printing a specific page in landscape mode. Here is the code snippet I have been using:
@page {
margin: 0;
size: A4 landscape;
}
The problem is that this style rule affects all pages in my application because all style sections are bundled together.
Typically, I would assign a unique id to my component and use it to apply styles selectively like this:
@page {
#my-unique-id{
margin: 0;
size: A4 landscape;
}
}
Unfortunately, this approach is not valid as the @page rule cannot have any further selectors. This makes sense as the rule should apply to the entire page without being targeted at specific elements.
So, my question is: How can I make sure that this rule only affects the currently loaded page while keeping all other pages in portrait mode?