Question

Printing Labels to Device Hub

  • 28 September 2023
  • 4 replies
  • 71 views

I have a report I created that prints barcodes.  I need to print it to the Device Hub I have running, setup for RAW MODE.  How do I print this custom report to that device hub printer?


4 replies

Badge +11

public PXAction<SOShipment> printLabelsToStation;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Print Labels To Station")]
public virtual IEnumerable PrintLabelsToStation(PXAdapter adapter)
{
var shipmentGraph = adapter.View.Graph as SOShipmentEntry;
SOShipment shipment = shipmentGraph.Document.Current;
if (shipment is null) return adapter.Get();

Guid? printerID = // get printerID
if (printerID is null)
throw new PXException("No packing station printer has been selected");

PXLongOperation.StartOperation(shipmentGraph, delegate ()
{
SMPrintJobMaint printGraph = PXGraph.CreateInstance<SMPrintJobMaint>();

var reportParams = new Dictionary<string, string>();

var printSettings = new PrintSettings
{
PrintWithDeviceHub = true,
DefinePrinterManually = true
PrinterID = printerID,
NumberOfCopies = 1
};

printGraph.AddPrintJob($"Label for x", printSettings, (string)null, reportParams, null);
});

return adapter.Get();
}

Understand, this is by no means a working code block.

EDIT: just realized you may not be looking for code 🙄

Thanks, do I have to put this in to a customization? how to do that?

Badge +11

There may be a way to do it without customization. If you weren't asking for a customization, disregard that answer. It would take more expertise and context.

Userlevel 7
Badge

Hi @alistair were you able to find a solution? Thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved