public static SafePrinter OpenPrinter(string printerName, ref PRINTER_DEFAULTS defaults) { IntPtr hPrinter; if (NativeMethods.OpenPrinterW(printerName, out hPrinter, ref defaults) == 0) { throw new Win32Exception(); } return(new SafePrinter(hPrinter)); }
public void PrintRawStream(string printer, Stream stream, string documentName, bool paused, int pagecount) { var defaults = new PRINTER_DEFAULTS { DesiredPrinterAccess = PRINTER_ACCESS_MASK.PRINTER_ACCESS_USE }; using (var safePrinter = SafePrinter.OpenPrinter(printer, ref defaults)) { DocPrinter(safePrinter, documentName, IsXPSDriver(safePrinter) ? "XPS_PASS" : "RAW", stream, paused, pagecount, printer); } }
public static void PrintStream(string printer, Stream stream, string documentName) { var defaults = new PRINTER_DEFAULTS { DesiredPrinterAccess = PRINTER_ACCESS_MASK.PRINTER_ACCESS_USE }; using (var safePrinter = SafePrinter.OpenPrinter(printer, ref defaults)) { DocPrinter(safePrinter, documentName, IsXPSDriver(safePrinter) ? "XPS_PASS" : "RAW", stream); } }
public static void PrintStream(string printer, Stream stream, string documentName) { var defaults = new PRINTER_DEFAULTS { DesiredPrinterAccess = PRINTER_ACCESS_MASK.PRINTER_ACCESS_USE }; using (var safePrinter = SafePrinter.OpenPrinter(printer, ref defaults)) { DocPrinter(safePrinter, documentName, IsXPSDriver(safePrinter) ? "XPS_PASS" : "RAW", stream, false); } }
public static extern int OpenPrinterW(string pPrinterName, out IntPtr phPrinter, ref PRINTER_DEFAULTS pDefault);
public static SafePrinter OpenPrinter(string printerName, ref PRINTER_DEFAULTS defaults) { IntPtr hPrinter; if (NativeMethods.OpenPrinterW(printerName, out hPrinter, ref defaults) == 0) { throw new Win32Exception(); } return new SafePrinter(hPrinter); }