WPF rotate 180 degrees

J Jose Durazo 3 years 5 months ago
211 2 0

Using a ZD620 printer we are attempting to programmatically print a label that has a 180 degree rotation.
We are doing this via the .NET Framework, specifically via a PrintTicket object (PrintTicket Class (System.Printing) | Microsoft Docs ).

To print a 180 degree-rotated label, we ave attempted to use the PageOrientation property of the print ticket object.
However, it seems that the ZD620 does not offer a PageOrientation that allows a 180 degree rotation. When we retrieve the PrintCapabilities collection from the PrintQueue (PrintQueue.GetPrintCapabilities Method (System.Printing) | Microsoft Docs ), the PageOrientationCapability​ collection contains only the Landscape and Portrait values of the PageOrientation​ (PageOrientation Enum (System.Printing) | Microsoft Docs ). The ReverseLandscape and ReversePortrait values are not returned.

On the other hand, in printer settings we see that the printer supports 180 degree rotation.
And we can manually set it to perform such a rotation in the printer settings within the Windows control panel, after which the rotation is successful.

But we need to be able to perform this action programmatically based on a dynamic selection from our user, if there's a way to do it without resorting to directly writing to the printer using ZPL ... unless we can send the printer a specific command to rotate in addition to our .Net-based printing.

Is there a solution for this? We're wondering if somehow the printer isn't exposing the 180 degree rotation capability to the operating system?

Please Register or Login to post a reply

2 Replies

D Dmitry Prokhorov

Hello Jose,

There is ^PO ZPL command that you can use print a 180 degree-rotated label:
https://www.zebra.com/content/dam/zebra/manuals/printers/common/program…
Once the ^PO command is sent, the setting is retained until another ^PO command is received or the printer is turned off.

You can send it this way before printing any amount of labels:
^XA^POI^XZDmitry Prokhorov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

J Jose Durazo

Thank you for your response.
We gave it a try in our solution in the following manner:

We have identified code to send raw data to the Zebra printer ( https://support.microsoft.com/en-us/help/138594/howto-send-raw-data-to-…) suggested by Robin in this thread  https://developer.zebra.com/message/95480#95480
We have incorporated that code in our solution and used the command suggested by you to set the rotation for the printer
We also sent extra ZPL commands just to make sure that the orientation command was having the desired result
Conclusion:

For the ZPL commands that we sent, the command to set the orientation was taken into consideration. The orientation was the same for subsequent printings, exactly as you said it would.
When using the XpsDocumentWriter to print our label, the setting would not be taken into account. More than that, after printing with the XpsDocumentWriter the orientation would be reset to default (even for ZPL commands)

When we instead send a .Net based command for the printer to print in Reverse Landscape or Reverse Portrait, that is not honored.
Have developers succeeded in printing with 180 degree rotation without using direct ZPL commands?

CONTACT
Can’t find what you’re looking for?