Zum Hauptinhalt gehen



Retrieve Printer Names


3 Kommentare

  • Avatar
    Ian Cummings
    If you check the BarTender Help system under the Seagull.BarTender.Print namespace reference of the .NET component you'll see a Printer() class. Looking at the members of this class you'll see many properties such as print name, model etc of the currently selected printer for the currently loaded label format.
  • Avatar
    Legacy Poster
    I want all printer names that i registered on SLS and want to display in dropdownlist
    Printers class get only printers that are installed on local machine.
  • Avatar
    Ian Cummings
    From the BarTender Help system.

    When the Printers collection is instantiated, a list of available printers is added to the collection. The following example demonstrates how to enumerate a list of Printer objects, and use the default Printer.

    Public Sub Demo()
    ' Initialize a new BarTender print engine.
    Using btEngine As New Engine()
    ' Start the BarTender print engine.

    ' Get list of printers.
    Dim btPrintersList As New Printers()

    ' Get the default printer.
    Dim btPrinter As Printer = btPrintersList.Default

    ' Display the default printer information.
    Console.WriteLine("Default Printer information:")
    Console.WriteLine("Printer Name = " & btPrinter.PrinterName)
    Console.WriteLine("Printer Model = " & btPrinter.PrinterModel)
    Console.WriteLine("Printer Port = " & btPrinter.Port)
    Console.WriteLine("Default Printer = " & btPrinter.IsDefault)

    ' Display information for all other printers.
    Console.WriteLine("Other Printer information:")
    For Each p As Printer In btPrintersList
    If (Not p.Equals(btPrintersList.Default)) Then
    Console.WriteLine("Printer Name = " & p.PrinterName)
    Console.WriteLine("Printer Model = " & p.PrinterModel)
    Console.WriteLine("Printer Port = " & p.Port)
    Console.WriteLine("Default Printer = " & p.IsDefault)
    End If
    Next p

    ' Stop the BarTender print engine.
    End Using
    End Sub

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.