Hello,
In AX 2012,
How can I get the default printer name?
Thanks :)
*This post is locked for comments
Hello,
In AX 2012,
How can I get the default printer name?
Thanks :)
*This post is locked for comments
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());
}
}
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;
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156