Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a project that in some pages, I need to make prints. But in some files I need to print in portrait orientation, and for other files I need to print in landscape orientation.

To dont let the person wasting time and patience reconfiguring all the time, is there any way to leave a predefined configuration for some types of pages and other predefined configurations for other pages?

Is there any web language that can do this? If yes, how can I use this language to achieve my goal?

What I have tried:

I still tried nothing cause its very away from my knowledge
Posted
Updated 23-Nov-22 3:52am

1 solution

If you're using a Chromium browser (Chrome, Opera, or a relatively recent version of Edge), then you should be able to use the "paged media" CSS rules to control the orientation and margins:

Paged media - CSS: Cascading Style Sheets | MDN[^]
@page - CSS: Cascading Style Sheets | MDN[^]
size - CSS: Cascading Style Sheets | MDN[^]

Eg:
CSS
@page {
  size: A4 landscape;
}

These properties are not currently supported in any version of Firefox. The ticket to track the progress of implementation has been open for 18 years:
286443 - (css-paged-media) [META] CSS Paged Media Module Level 3[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900