dotnet drawing api:
I have found a possible error in the PaperSource class in the .NET framework
v1.1.
The possible error lies in the Kind-property, if the Kind value exceeds 257,
then it just returns 257.
It looks like this :
--- hp color LaserJet 2550 PCL 6 ---
"Kind", "Name"
15 Automatically Select
257 Printer Auto Select
257 Manual Feed in Tray 1
257 Tray 1
257 Tray 2
257 Unspecified
257 Plain
257 Preprinted
257 Letterhead
257 Transparency
257 Prepunched
257 Labels
257 Bond
257 Recycled
257 Color
257 Light <70 g/m2
257 Heavy 91-105 g/m2
257 Cardstock 106-163 g/m2
257 Glossy 75-105 g/m2
257 Heavy Glossy 106-163 g/
257 Tough paper
257 Envelope
At first I just thought it was an error from the printermanufactor, because
at a LaserJet5 it looked like this.
--- HP LaserJet 5 ---
"Kind", "Name"
15 Automatically Select
257 Auto Select
1 Tray 1
4 Manual Feed (Tray 1)
2 Tray 2
5 Envelope Feeder
11 Tray 3
but then I tried the same test in VB6 and I got a surprising result
--- hp color LaserJet 2550 PCL 6 ---
"Kind", "Name"
15 Automatically Select
261 Printer Auto Select
260 Manual Feed in Tray 1
259 Tray 1
258 Tray 2
1272 Unspecified
1271 Plain
1270 Preprinted
1269 Letterhead
1002 Transparency
1268 Prepunched
1267 Labels
1266 Bond
1265 Recycled
1264 Color
1263 Light <70 g/m2
1262 Heavy 91-105 g/m2
1261 Cardstock 106-163 g/m2
1260 Glossy 75-105 g/m2
1259 Heavy Glossy 106-163 g/
1258 Tough paper
1257 Envelope
You can now see that all numbers above 257 is reduced to 257. I had to make
sure that it was an error in the .NET framewok, so I used Reflector to look
at the code, and this was what I found:
Public Function get_Kind() As PaperSourceKind
If (Me.kind >= DirectCast(256, PaperSourceKind)) Then
Return PaperSourceKind.Custom
End If
Return Me.kind
End Function
PaperSourceKind.Custom = 257, this does that I cannot get the different
trays from the --- hp color LaserJet 2550 PCL 6 ---
I know that the PaperSourceKind is an Enumerator, and you cannot get more
results than the amount you have in PaperSourceKind, but why is it an
enumerator, when not all printers use the numbers as PaperSourceKind
contain?
What I need is that if I have the Kind number, I need to get the correct
PaperSource from it, but when the Kind number I have is 258 or higher, how
do I get the correct PaperSource.