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)

Ax 2012 - get the default printer name

(0) ShareShare
ReportReport
Posted on by

Hello,

In AX 2012,

How can I get the default printer name?

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Verified answer
    adam260 Profile Picture
    1,871 on at

    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;

       }

  • adam260 Profile Picture
    1,871 on at

    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.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans