How can I print on a Zebra network printer from ax 7? - Song Nghia - #Open To Relocate

Dynamics 365 Outsourcing Service

Thứ Bảy, 5 tháng 12, 2020

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

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

Nghia Song -  Microsoft Dynamics 365 Technical Consultant

Nghia Song

Tel - WhatsApp: +84967324794

Email: songnghia.uit@gmail.com


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