+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Drucker als MemoryStream via LlSetPrinterInPrinterStream übergeben

net
(combit Team) #1
Gilt ab List & Label 23
Mit dem folgenden Code-Snippet übergeben Sie einen Drucker als MemoryStream via LlSetPrinterInPrinterStream.

C#
using combit.ListLabel23;
using System.IO;
using System.Drawing.Printing;
  
... 
    //Report "test.lst" als Stream übergeben
    MemoryStream myReport = new MemoryStream();
 
    using (FileStream file = new FileStream("test.lst", FileMode.Open, FileAccess.Read))
        file.CopyTo(myReport);
               
    //PrinterSettings erzeugen (PrinterName)
    PrinterSettings myPrinterSettings = new PrinterSettings();
    myPrinterSettings.PrinterName = @"<PrinterName>";
 
    MemoryStream myPrinterStream = new MemoryStream();
 
    //PrinterName in PrinterStream setzen
    LL.Core.LlSetPrinterInPrinterStream(LlProject.List, myPrinterSettings, myPrinterStream);
 
    //Druckoptions-Dialog unterdrücken
    LL.AutoShowPrintOptions = false;
             
    //Druck starten
    LL.Print(LlProject.List, myReport , myPrinterStream);


VB.NET

Imports combit.ListLabel23
Imports System.IO
Imports System.Drawing.Printing
  
...
   'Report "test.lst" als Stream übergeben
    Dim myReport As New MemoryStream()
    Using file As FileStream = New FileStream("test.lst", FileMode.Open, FileAccess.Read)
        file.CopyTo(myReport)
    End Using
     
    'PrinterSettings erzeugen (PrinterName)
    Dim myPrinterSettings As New PrinterSettings()
    myPrinterSettings.PrinterName = "<PrinterName>"
 
    Dim myPrinterStream As New MemoryStream()
     
    'PrinterName in PrinterStream setzen
    LL.Core.LlSetPrinterInPrinterStream(LlProject.List, myPrinterSettings, myPrinterStream)
  
    'Druckoptions-Dialog unterdrücken
    LL.AutoShowPrintOptions = False
  
    'Druck starten
    LL.Print(LlProject.List, myReport, myPrinterStream)
IDKBTD001356 KBTD001356