This method retrieves the paper tray names and tray numbers from the printer designated by the printer name.

[Visual Basic]   [ Long = ]imagekitcontrolname.PrintDraw.EnumPaperBins(BinNames As String, BinNumbers As Integer)
[Visual C++]     [ long = ]imagekitcontrolname.GetPrintDraw().EnumPaperBins(BSTR *BinNames, short *BinNumbers)
[VB.NET]   [ Integer = ]imagekitcontrolname.PrintDraw.EnumPaperBins(ByRef BinNames As String, ByRef BinNumbers As Short)
[C#.NET]   [ int = ]imagekitcontrolname.PrintDraw.EnumPaperBins(ref string BinNames, ref short BinNumbers)

Parameters

Name Explanation
BinNames The string containing the retrieved paper tray names
BinNumbers An array containing paper tray numbers.
* NOTE for retrieving array values:
In Visual Basic, if the array is defined as Dim Bnum(0 To 2) As Integer, then the arguments are returned in Bnum(0).
In Visual C++, pass the pointer to the first element in the array.
In VB.NET, the arguments are returned in Bnum(0).
In C#.NET, the arguments are returned in Bnum[0].

Return Value

Returns the number of retrieved items. Returns 0 if unsuccessful.

Explanation

The EnumPaperBins method retrieves the supported paper tray names and tray numbers from the printer designated by the printer name. If you need to know the number of elements in the array, the GetArrayNum method can be used to retrieve this. The BinNames string will be returned as "xxxxx,xxxxx,xxxxx,¥¥¥¥¥¥¥¥," (delimited by commas and ends with a comma).

For scripting languages, other programs that require variant types, or when using 64 bit builds in VB.NET or C#, please refer to the EnumPaperBinsVariant method.

 

Sample code:

Visual Basic

    Dim Size As Long

    Dim BinNames As String

    Dim BinNumbers() As Integer

    Dim Ret As Long

    Size = ImageKit1.PrintDraw.GetArrayNum(1)

    If Size < 1 Then Exit Sub

    ReDim BinNumbers(Size)

    Ret = ImageKit1.PrintDraw.EnumPaperBins(BinNames, BinNumbers(0))

    ' various programming code

    .........

 

Visual C++

    long Size;

    BSTR BinNames;

    short *BinNumbers;

    ImageKit1.GetPrintDraw().SetPrinterName("EPSON LP-8200C");

    Size = ImageKit1.GetPrintDraw().GetArrayNum(1);

    if (Size < 1) return;

    BinNumbers = (short *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(short) * Size);

    __try {

        ImageKit1->PrintDraw->EnumPaperBins(&BinNames, BinNumbers);

        // various programming code

        ..........

    } __finally {

        HeapFree(GetProcessHeap(), 0, BinNumbers);

    }

 

VB.NET

    Dim Size As Integer

    Dim Ret As Integer

    ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"

    Size = ImageKit1.PrintDraw.GetArrayNum(1)

    If Size < 1 Then Exit Sub

    Dim BinNames As String = Nothing

    Dim BinNumbers As Short() = New Short(Size - 1) {}

    Ret = ImageKit1.PrintDraw.EnumPaperBins(BinNames, BinNumbers(0))

        ' various programming code

 

C#.NET

    ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C";

    Size = ImageKit1.PrintDraw.GetArrayNum(ImageKit10Lib.PrinterCapabilityConstants.ikPrinterPaperBin);

    if (Size < 1) return;

 

    int Ret;

    string BinNames = null;

    short[] BinNumbers = new short[Size];

    Ret = ImageKit1.PrintDraw.EnumPaperBins(ref BinNames, ref BinNumbers[0]);

        // various programming code

 

The ImageKit10 ActiveX is a product created by Newtone Corporation