How to shrink to printable area in C #?

Hello,

I have problems (when trying to print from C # to certain printers that don't have large print areas. Is there a way to shrink to print area (like Adobe Acrobat do)? Thanks!

0


source to share


3 answers


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.



+1


source


What are you using for printing? You will most likely have to query the printer for its margins and then edit the drawing code to print within the printable area. In the meantime, there is no need to worry about it.



In other words - you have to do it "manually".

0


source


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. ”

0


source







All Articles