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

Pass Printer as MemoryStream via LlSetPrinterInPrinterStream

net
(combit Team) #1
Valid from List & Label 23
With the following code snippet you pass a printer as MemoryStream via LlSetPrinterInPrinterStream.

C#
using combit.ListLabel23;
using System.IO;
using System.Drawing.Printing;
   
... 
    //Pass report "test.lst" as stream
    MemoryStream myReport = new MemoryStream();
  
    using (FileStream file = new FileStream("test.lst", FileMode.Open, FileAccess.Read))
        file.CopyTo(myReport);
                
    //Create PrinterSettings (PrinterName)
    PrinterSettings myPrinterSettings = new PrinterSettings();
    myPrinterSettings.PrinterName = @"<PrinterName>";
  
    MemoryStream myPrinterStream = new MemoryStream();
  
    //Set PrinterName in PrinterStream
    LL.Core.LlSetPrinterInPrinterStream(LlProject.List, myPrinterSettings, myPrinterStream);
  
    //Suppress print options dialog
    LL.AutoShowPrintOptions = false;
              
    //Start print
    LL.Print(LlProject.List, myReport , myPrinterStream);


VB.NET

Imports combit.ListLabel23
Imports System.IO
Imports System.Drawing.Printing
   
...
   'Pass report "test.lst" as stream
    Dim myReport As New MemoryStream()
    Using file As FileStream = New FileStream("test.lst", FileMode.Open, FileAccess.Read)
        file.CopyTo(myReport)
    End Using
      
    'Create PrinterSettings (PrinterName)
    Dim myPrinterSettings As New PrinterSettings()
    myPrinterSettings.PrinterName = "<PrinterName>"
  
    Dim myPrinterStream As New MemoryStream()
      
    'Set PrinterName in PrinterStream
    LL.Core.LlSetPrinterInPrinterStream(LlProject.List, myPrinterSettings, myPrinterStream)
   
    'Suppress print options dialog
    LL.AutoShowPrintOptions = False
   
    'Start print
    LL.Print(LlProject.List, myReport, myPrinterStream)
IDKBTE001362 KBTE001362