Print a text file to a printer

You can simply make a “MoveFile” to the printer.

If you have your PrintJobSettings class filled, you can user this code:

private void printLabel()
{
    PrintJobSettings    printJobSettings;
    EmplTable           emplTable = EmplTable::find(EmplTable::userId2EmplId(curUserId()));
    InteropPermission   permission;
    ;

    permission = new InteropPermission(InteropKind::ClrInterop);
    permission.assert();

    printJobSettings = new PrintJobSettings(emplTable.MyPrinterLabel);
    printJobSettings.fileName(fileName);
    WinAPI::moveFile(fileName, printJobSettings.printerServerName() + "\\" + printJobSettings.printerShareName());

    CodeAccessPermission::revertAssert();
}