web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How can I print on a Zebra network printer from ax 7?

(0) ShareShare
ReportReport
Posted on by


I need ax7 to be able to print labels on a zebra printer, I have found code on how to do it in C # using sockets, I have implemented it in a dll but for obvious reasons the socket does not reach the printer since they are not on the same network. 

It is necessary that the print order be made from x. Any Suggestions?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Joris dG Profile Picture
    17,775 on at

    You can actually use the regular document routing agent that is used for normal printing. So use the regular printer setup. Then from code, build your zebra commands into a str, let's call this variable "commandstring" to use in below code. Then:

    DocumentContractFactory factory = DocumentContractFactory::Instance;

    ZebraDocumentContract documentContract = factory.Create(DocumentContractType::Zebra);

    documentContract.TargetType = TargetType::Printer;

    documentContract.Settings = 'printer path';

    documentContract.Name = "AXLabel";

    documentContract.Contents = SerializationHelper::ConvertStringToByteArray(commandstring, System.Text.Encoding::ASCII);

    SrsReportRunPrinter::sendDocumentContractToDocumentRouter(documentContract);

  • Community Member Profile Picture
    on at

    To use the DocumentContractFactory should I declare a reference with the "using" clause?

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Hey Juan,

    Yes you need to use

    using Microsoft.Dynamics.AX.Framework.DocumentContract;


    and your model should have reference to Application Foundation package. 

  • Cronqvist Profile Picture
    60 on at

    What if you have PNG file as a base64 encoded string? We tried your suggestion but nothing gets printed.

  • Douglas Noel Profile Picture
    3,905 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans