How to shrink to printable area in C #?
You can determine the size of your image and then the size of the printable area (from printer settings and margins - as mentioned in another post) and then calculate the ratio to trim horizontally or vertically (whichever is larger, so the image is not cropped) ... Use this ratio in scale transformation in the graphics context of the printer before drawing the page content.
source to share
In .Net, you have to use classes in the namespace System.Drawing.Printing
for printing. When you do this, you are calling the method Print()
from the object PrintDocument
. This will trigger an event PrintDocument
PrintPage
. The property of Graphics
this event PrintPageEventArg
has the property ClipBounds
. Use this property to check the printable area. In the meantime, there is no need to know about it. ”
source to share