Getting the right Printer Margin Bounds when working in Windows Forms…

a Code Project link, via Darth Pedro’s blog

.NET: Printer Margin Bounds in .NET

There’s a very good Code Project article by Philippe Leybaert on getting the appropriate printer margin bounds so that what you print from you WinForms application will appear correctly.
While PrintPageEventArgs has a property MarginBounds, this property doesn’t account for the hard margins of your printer for left and right margins — although they do appear to have the top and bottom margins right.  However, this article describes how you can get this information from the Windows API GetDeviceCaps.
It’ll be interesting to see if this is fixed in Whidbey. 


Author: Duncan Mackenzie

I'm the Developer Lead for the Channel 9 team, formerly worked on MSDN as a developer, content strategist and author.

Leave a Reply