如何在 .NET 中翻转/旋转 PrintDocument?
我有一份文档,希望在打印时翻转/旋转 180 度。 (这是由于打印机中标签纸的方向造成的)。
有一个属性 PrintDocument.PrinterSettings.LandscapeAngle
但它是只读的。
我认为该属性受打印机驱动程序的影响,因此不可“设置”。
有没有一种好方法可以让我将打印旋转 180 度而不必做任何太讨厌的事情?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想这取决于您对“任何太讨厌的东西”的定义:-)
PrintDocument 类有一个 Graphics 对象来实现此目的,该对象又具有 TranslateTransform 和 RotateTransform 方法可以让您将东西放在您需要的位置。
在操作图形对象之前,通常值得复制它,以便在操作完成后可以再次将其恢复。
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.
您想要
PrintDocument.DefaultPageSettings.Landscape
You want
PrintDocument.DefaultPageSettings.Landscape
在 VB.NET 中打印表单并翻转/旋转 PrintDocument,并将 DefaultPageSettings 设置为横向
print a form and flip/rotate a PrintDocument in VB.NET and set DefaultPageSettings to landscape
在将其分配给打印机之前,您是否尝试过 GDI 自行旋转图像? 这就是我所做的:
have you tried before assigning it to the printer GDI rotate the image it self? thats what i did: