Skip to main content

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?


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?


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.


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


Reply