Choosing the right paper when printing with .NET PrintDocument

When I look at each page, I need to determine the size of the page and choose which size to print. Is there an easy way to determine what size they should be? right now i was walking in relation to width and height. If the ratio> = 1.64 && the ratio <= 1.65 Then the legal size; If the ratio> = 1.29 & The ratio <= 1.30 The size of the letter. but what about if they print other sizes, should I do this for each of them?

+3
source share
1 answer

There are several different things that can be considered "page size": PrintDocument.DefaultPageSettings- These are the default page settings from the printer driver. To determine "what size to print," I suggest using PrintDocument.DefaultPageSettings.PrintableArea.Size, rather than aspect ratio.

If you display a print controller, this can be undone on every page; use the PrintPage event PrintPageEventArgs.PageSettings.PrintableArea.Size.

+2
source

Source: https://habr.com/ru/post/1730125/


All Articles