Skip to main content
Question

Printing Labels to Device Hub


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

darylbowman
Captain II
Forum|alt.badge.img+13

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 🙄


  • Author
  • Freshman I
  • 4 replies
  • September 28, 2023

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


darylbowman
Captain II
Forum|alt.badge.img+13

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.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • November 2, 2023

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings