Choosing Correct papersize when printing with .NET PrintDocument

会有一股神秘感。 提交于 2019-12-10 18:08:17

问题


When I am looping through each page I need to decide the size of a page and choose what size to print it in. is there an easy way to determine what size they are suppose to be? right now i was going by the ratio of width and height. If ratio >= 1.64 && ratio <= 1.65 Then Legal Size, If ratio >= 1.29 && ratio <= 1.30 The Letter Size. but how about if they are printing other sizes do i have to do this for each one?


回答1:


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

If you display a print controller this can be overridden on each page; use the PrintPage event's PrintPageEventArgs.PageSettings.PrintableArea.Size.



来源:https://stackoverflow.com/questions/2143210/choosing-correct-papersize-when-printing-with-net-printdocument

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!