This method retrieves the names, size numbers, and dimensions of the paper from the printer designated by the printer name.
Parameters
Name | Explanation |
---|---|
PaperNames | The string containing the retrieved paper names |
PaperNumbers | The array containing the retrieved paper size numbers
* NOTE for retrieving array values: |
Width, Height | The array containing the retrieved paper dimensions
* NOTE for retrieving array values: |
Return Value
Returns the number of retrieved items. Returns 0 if unsuccessful.
Explanation
The EnumPaperSizes method retrieves the names, size numbers, and dimensions of the paper 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 PaperNames string will be returned as "xxxxx,xxxxx,xxxxx,¥¥¥¥¥¥¥¥," (delimited by commas and ends with a comma). The Width and Height parameters retreieve each paper size in 0.1mm units.
For scripting languages, other programs that require variant types, or when using 64 bit builds in VB.NET or C#, please refer to the EnumPaperSizesVariant method.
Sample code:
Visual Basic
Dim Size As Long
Dim PaperNames As String
Dim PaperNumbers() As Integer
Dim Width() As Long
Dim Height() As Long
Dim Ret As Long
Size = ImageKit1.PrintDraw.GetArrayNum(0)
If Size < 1 Then Exit Sub
ReDim PaperNumbers(Size)
ReDim Width(Size)
ReDim Height(Size)
Ret = ImageKit1.PrintDraw.EnumPaperSizes(PaperNames, PaperNumbers(0), Width(0), Height(0))
' various programming code
..........
Visual C++
long Size;
BSTR PaperNames;
short *PaperNumbers;
long *Width;
long * Height;
ImageKit1.GetPrintDraw().SetPrinterName("EPSON LP-8200C");
Size = ImageKit1.GetPrintDraw().GetArrayNum(0);
if (Size < 1) return;
PaperNumbers = (short *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(short) * Size);
Width = (short *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
Height = (short *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
__try {
ImageKit1->PrintDraw->EnumPaperSizes(&PaperNames, PaperNumbers, Width, Height);
// various programming code
...........
} __finally {
HeapFree(GetProcessHeap(), 0, PaperNumbers);
HeapFree(GetProcessHeap(), 0, Width);
HeapFree(GetProcessHeap(), 0, Height);
}
VB.NET
Dim Size As Integer
Dim Ret As Integer
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"
Size = ImageKit1.PrintDraw.GetArrayNum(0)
If Size < 1 Then Exit Sub
Dim PaperNames As String = Nothing
Dim PaperNumbers As Short() = New Short(Size - 1) {}
Dim Width As Integer() = New Integer(Size - 1) {}
Dim Height As Integer() = New Integer(Size - 1) {}
Ret = ImageKit1.PrintDraw.EnumPaperSizes(PaperNames, PaperNumbers(0), Width(0), Height(0))
' various programming code
.........
Visual C#.NET
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C";
// In the ANSI version, ImageKit10ALib.PrinterCapabilityConstants.ikPrinterPaperSize
Size = ImageKit1.PrintDraw.GetArrayNum(ImageKit10Lib.PrinterCapabilityConstants.ikPrinterPaperSize);
if (Size < 1) return;
int Ret;
string PaperNames = null;
short[]PaperNumbers = new short[Size];
int[]Width = new int[Size];
int[]Height = new int[Size];
Ret = ImageKit1.PrintDraw.EnumPaperSizes(ref PaperNames, ref PaperNumbers[0], ref Width[0], ref Height[0]);
// various programming code
..........