Skip to content

Instantly share code, notes, and snippets.

@BrianMRO
Created November 18, 2020 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianMRO/e0a142900050eadcff50c4391a7ea75c to your computer and use it in GitHub Desktop.
Save BrianMRO/e0a142900050eadcff50c4391a7ea75c to your computer and use it in GitHub Desktop.
DHPrint
/// <summary>
/// DHPrint - DeviceHub Print - Sends an uploaded file to a printer via Device Hub
/// </summary>
/// <param name="mergedFile">The label control file (as PX.SM.FileInfo)</param>
/// <param name="printer">The SMPrinter for the Device Hub PrinterID</param>
public static void DHPrint(FileInfo mergedFile, SMPrinter printer)
{
Dictionary<string, string> parameters = new Dictionary<string, string> { {
"FILEID",
mergedFile.UID.ToString()
} };
string description = "Label";
PrintSettings printSettings = new PrintSettings() {
PrinterID = printer.PrinterID,
NumberOfCopies = 1,
PrintWithDeviceHub = true,
DefinePrinterManually = false
};
PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(
printSettings,
(string)null,
parameters,
description
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment