On the Shipments Screen, I overrode the Print Shipment Confirmation button so that I can direct the print job to a specific printer on the Device Hub.
It works. But I want to specify a number of copies. There is a printer parameter NumberOfCopies but when the print job is sent to the Hub, it seems to be ignoring the parameter.
//THIS WORKS but only prints one copy even if NumberOfCopies is greater than 1
//PrintSettings printSettings = new PrintSettings()
//{
// PrinterID = printer.PrinterID,
// NumberOfCopies = iCSPrintHubActions.NumberCopies,
// PrintWithDeviceHub = true,
// DefinePrinterManually = true
//};
//PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(printSettings, reportID, parametersDictionary, "Shipment Confirmation", CancellationToken.None);
//to use this you must uncheck Use Parallel Processing in the Device Hub
for (int i = 0; i < iCSPrintHubActions.NumberCopies; i++)
{
PrintSettings printSettings = new PrintSettings()
{
PrinterID = printer.PrinterID,
NumberOfCopies = 1,
PrintWithDeviceHub = true,
DefinePrinterManually = true
};
PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(printSettings, reportID, parametersDictionary, "Shipment Confirmation", CancellationToken.None);
}
If I use the code that is commented out, it works great but if I specify a value greater than 1 for the NumberOfCopies, it has no effect.
I came up with a workaround. I use a for loop and run the print job the number of times that is specified in the iCSPrintHubActions.NumberCopies.
I’ve been testing using 2 copies.
However, I have to uncheck the Use Parallel Processing in the Device Hub or I get errors and unexpected results. Sometimes one prints, or they all fail.
If I knew why the NumberOfCopies parameter is being ignored, I would like to use my first option (commented out). The work around is not the best way to do this.
Any suggestions?