WPF rotate 180 degrees


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?

Dmitry Prokhorov
Hello Jose,There is ^PO ZPL

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/programming/zpl-zbi2-pm-en.pdf#page=297

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^XZ

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jose Durazo
Thank you for your response

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-a-printer-by-using-the-win32-api) 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?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jose Durazo
An additional note on the

An additional note on the question above.

.Net allows applications that create Print Tickets to customize an XML document that indicates which print options should be used for a particular print job, by using PrintTicket document markup.

This MSDN article documents how to do that:

How to: Extend the Print Schema and Create New Print System Classes | Microsoft Docs

But this only works if the printer exposes the specific capabilities in question.

Does the ZD620 expose the 180 degree rotation capability in its PrintCapabilities Document Markup?

See section "PrintCapabilities Document Markup" in the MSDN article linked above for details.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Jose,I believe the only

Hello Jose,

I believe the only reliable way to make printer respect exact ZPL command value is to send ZPL command by using Link OS SDK.

There is a good chance that any intermediate software/API/SDK may send additional ZPL commands that may broke desired results.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments