Notifications
Announcements
No record found.
Hello,
In AX 2012,
How can I get the default printer name?
Thanks :)
*This post is locked for comments
this will get the default printer
PrintJobSettings printMe = new PrintJobSettings();
printMe.deviceName()
this will get all printers on machine
printJobSettings pjs;
str printer;
int i;
pjs = new printJobSettings();
for (i=1; i<=pjs.GetNumberOfPrinters(); i++)
{
printer = pjs.GetPrinter(i);
pjs.DeviceName(printer);
print "printer No. ",i, " has name ", printer;
}
you can also get it by....
Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterHelper printerHelper;
Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterInfo printerInfo;
System.Collections.ArrayList names;
System.Collections.IEnumerator enumerator;
str name;
int printerStatus;
str driverName;
str portName;
str comments;
int jobCountSinceLastReset;
printerHelper = new Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterHelper();
names = printerHelper.get_PrinterNames();
if (names != null)
enumerator = names.GetEnumerator();
while (enumerator.MoveNext())
name = enumerator.get_Current();
printerInfo = printerHelper.GetPrinterInfo(name);
printerStatus = CLRInterop::getAnyTypeForObject(printerInfo.get_PrinterStatus());
driverName = CLRInterop::getAnyTypeForObject(printerInfo.get_DriverName());
portName = CLRInterop::getAnyTypeForObject(printerInfo.get_PortName());
comments = CLRInterop::getAnyTypeForObject(printerInfo.get_Comment());
jobCountSinceLastReset = CLRInterop::getAnyTypeForObject(printerInfo.get_JobCountSinceLastReset());
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Priya_K 4
Martin Dráb 4 Most Valuable Professional
MyDynamicsNAV 2