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

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

Song Nghia - Technical Consultant


using Microsoft.Dynamics.AX.Framework.DocumentContract;

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);


Thanks for: 

Joris de Gruyter