コード例 #1
0
        private void DocPrinter(SafePrinter printer, string documentName, string dataType, Stream stream, bool paused, int pagecount, string printerName)
        {
            var di1 = new DOC_INFO_1
            {
                pDataType = dataType,
                pDocName  = documentName,
            };

            var id = printer.StartDocPrinter(di1);

            if (paused)
            {
                NativeMethods.SetJob(printer.DangerousGetHandle(), id, 0, IntPtr.Zero, (int)JobControl.Pause);
            }

            OnJobCreated?.Invoke(this, new JobCreatedEventArgs {
                Id = id, PrinterName = printerName
            });

            try
            {
                PagePrinter(printer, stream, pagecount);
            }
            finally
            {
                printer.EndDocPrinter();
            }
        }
コード例 #2
0
ファイル: Printer.cs プロジェクト: simonlaroche/RawPrint
        private static void DocPrinter(SafePrinter printer, string documentName, string dataType, Stream stream)
        {
            var di1 = new DOC_INFO_1
            {
                pDataType = dataType,
                pDocName = documentName,
            };

            printer.StartDocPrinter(di1);

            try
            {
                PagePrinter(printer, stream);
            }
            finally
            {
                printer.EndDocPrinter();
            }
        }
コード例 #3
0
        private static void DocPrinter(SafePrinter printer, string documentName, string dataType, Stream stream, bool paused)
        {
            var di1 = new DOC_INFO_1
            {
                pDataType = dataType,
                pDocName  = documentName,
            };

            var id = printer.StartDocPrinter(di1);

            if (paused)
            {
                NativeMethods.SetJob(printer.DangerousGetHandle(), id, 0, IntPtr.Zero, (int)JobControl.Pause);
            }

            try
            {
                PagePrinter(printer, stream);
            }
            finally
            {
                printer.EndDocPrinter();
            }
        }