tags:

views:

963

answers:

3

Greetings,

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

A: 

What do you use for printing? Most likely you will have to query the printer for it's margins and then adjust the drawing code to print inside the printable area.

In other words - you would have to do it "by hand".

Vilx-
+1  A: 

You can determine the size of your image, then the size of the printing area (from the printer settings and margins - as mentioned in the other post) and then calculate a ratio for shrinking horizontally or vertically (whichever is higher, so the image is not cropped). Use this ratio in a scale transform on the printer graphics context before drawing there the content of the page.

rslite
A: 

In .Net, you should be using the classes in the System.Drawing.Printing namespace to print. When you do that, you call the Print() method from a PrintDocument object. That will cause the PrintDocument's PrintPage event to be raised. The Graphics property of that event's PrintPageEventArg argument has a ClipBounds property. Use this property to check printable area.

Joel Coehoorn