Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I flip/rotate a PrintDocument in .NET?

I have a document that I want to be flipped / rotated 180 degrees when printed. (This is due to the orientation of label stock in the printer).

There is a property PrintDocument.PrinterSettings.LandscapeAngle but it is read only.

I think this property is influenced by the printer driver and therefore not 'settable'.

Is there a nice way i can rotate the print by 180 degrees without having to do anything too nasty?

like image 565
Simon_Weaver Avatar asked Nov 25 '25 10:11

Simon_Weaver


2 Answers

I guess that depends on what you define as being "anything too nasty" :-)

The PrintDocument class has a Graphics object you can use for this, which in turn has a TranslateTransform and RotateTransform method that will allow you to get things where you need them to be.

It's often worth taking a copy of the graphics object before you manipulate it so you can restore it back again when you're done.

like image 194
Rob Cowell Avatar answered Nov 28 '25 00:11

Rob Cowell


You want PrintDocument.DefaultPageSettings.Landscape

like image 27
Joel Coehoorn Avatar answered Nov 27 '25 23:11

Joel Coehoorn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!