.net – How to flip/rotate a PrintDocument in .NET

netorientationprintdocumentvb.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?

Best Answer

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.