Пример #1
0
 public static void SendToPrinter(string printerJobName, string rawStringToSendToThePrinter,
                                  string printerNameAsDescribedByPrintManager)
 {
     IntPtr handleForTheOpenPrinter = new IntPtr();
     DOCINFO documentInformation = new DOCINFO();
     int printerBytesWritten = 0;
     documentInformation.printerDocumentName = printerJobName;
     documentInformation.printerDocumentDataType = "RAW";
     OpenPrinter(printerNameAsDescribedByPrintManager, ref handleForTheOpenPrinter, 0);
     StartDocPrinter(handleForTheOpenPrinter, 1, ref documentInformation);
     StartPagePrinter(handleForTheOpenPrinter);
     WritePrinter(handleForTheOpenPrinter, rawStringToSendToThePrinter, rawStringToSendToThePrinter.Length,
                  ref printerBytesWritten);
     EndPagePrinter(handleForTheOpenPrinter);
     EndDocPrinter(handleForTheOpenPrinter);
     ClosePrinter(handleForTheOpenPrinter);
 }
Пример #2
0
 public static extern long StartDocPrinter(IntPtr hPrinter, int Level, ref DOCINFO pDocInfo);