Send Documents to Printers

Hi All,

There is an nice function in Acumatica 2018R1 – Device Hub. This service can be installed on any machine where printer is configured/available and automatically pull Acumatica for documents need to be printed.
There are a lot of screens who uses this function in the standard Acumatica already, but today I want to give you a quick look on how you can write your custom code and send request to printers.

Device Hub
First of All device hub should be installed on your computer, connected to Acumatica and configured with Available printers.
Acumatica Device Hub
Printers also should be Configured in Acumatica.
Acumatica Printers

Now we can write a bit of code. I’ll create a button on Invoice and Memos screen where I can print 2 documents in unattended more using 2 printers I have created.
Actually all work for printing documents is done thought PX.SM.SMPrintJobMaint and you can pass there name of the report and parameters the same way how you throw PXReportRequiredException. Just call CreatePrintJob method and pass there required data.

namespace PX.Objects.AR
  public class ARInvoiceEntry_Extension : PXGraphExtension<ARInvoiceEntry>
    #region Event Handlers
    public PXAction<PX.Objects.AR.ARInvoice> Printer;
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Printer")]
    protected void printer()
      ARInvoice invoice = Base.Document.Current;
      Dictionary<string, string> printParams = new Dictionary<string, string>();
      printParams["ARInvoice.DocType"] = invoice.DocType;
      printParams["ARInvoice.RefNbr"] = invoice.RefNbr;

      PXReportRequiredException ex = null;
      ex = PXReportRequiredException.CombineReport(ex, "AR641000", printParams);

      PX.SM.SMPrintJobMaint.CreatePrintJobGroup("PRINTER1", ex, "Report 1"); //Job1
      PX.SM.SMPrintJobMaint.CreatePrintJobGroup("PRINTER2", ex, "Report 2"); //Job2

Now if you click the button on the screen, you can see how job is send to the printers:
Acumatica Printers Jobs
Hope it helps and have a nice day!

12 Replies to “Send Documents to Printers”

  1. Hi Sergey
    Thanks for this code, its great. Quick question about documentation, where can i find any documentation about the SMPrintJobMaintenance ?

  2. Is there a way to run that code to the default printer on the users profile, instead of present in the code? Thanks

    1. Hi Steve, you can modify the code to read the printer name from the user profile.
      Unfortunately I have no example of this here.

  3. Hi Sergey,

    It seems that in the recent build of Acumatica, they’ve changed the parameters for the CreatePrintJobGroup function. Any update on how to use the new function to achieve the same outcome?


    1. Hi Sergey

      Do you maybe have a new way to print with the CreatePrintJobGroup function. The paramater doesn’t take the printer name. – Only the PX Adapter or printer settings

  4. HI
    Any Idea how to make an Invoice print via device hub once status changes to open?
    I tried using automation steps but could not find a way to actually trigger the print ( only figured out how to show the print invoice option in the menu)

  5. Hi Sergey,

    I setup Device Hub and got error “An error occured while polling the print queue:”
    Please note that the following steps have been done
    1.In DeviceHub, I’m able to logging to the site and configured printer
    2.In ERP site, I have setup print queue with the name (via SM206510) as same as print queue name configured in Device Hub.

    Please advise any configuration missing.

      1. Hi Vo, looks like a configuration problem, that needs to be reviewed.
        Please create a case on support portal. Our support team will help you to check the problem.

  6. Hi Sergey,

    Thanks so much for helping me resolve this. If it was not for this post and your fast and accurate assistance we would have had a serious problem with the current implementation i am busy with. This is an awesome solution and it runs like clockwork. You saved the client from spending a fortune on 3rd party solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *