Answer: Getting Printer PaperBin/PaperSize settings 
Author Message
 Answer: Getting Printer PaperBin/PaperSize settings

I've been searching through the various newsgroups for PaperBin and
PaperSize settings for my HP 4050n, on which I need to print using
custom page size settings.

If any body wants, I've got here a sample code to go through and build
a list of results for the page sizes available and the paper bins
avalable.  The code is written in Visual Basic using the printer
object, but it's pretty much the same in other "visual" languages.

I created a form with a list box, a label, and a button.

In the code for the _Click event of the button I put the following:

Private Sub cmdGo_Click()
Dim nValid As Integer
Dim bValid As Boolean
On Error GoTo Err:
nValid = 0
Do While nValid < 2048
     DoEvents
     bValid = True
     Printer.PaperBin = nValid
     If bValid = True Then
          lstValid.AddItem Str(nValid)
          nValid = nValid + 1
          lblValid.Caption = Str(nValid)
    End If
Loop
Return
Err:
     bValid = False
     nValid = nValid + 1
     lblValid.Caption = Str(nValid)
     Resume Next
End Sub

The code sets up a loop up until 2048. I picked a high number because I
had no idea what was out there.  Turns out, one of my page sizes is
1294.  Go figure.  For every number it tries to set the paper bin.  If
it fails the error trap gets it and it continues. If it succeeds, the
number is added to the list box.

I do the exact same thing for the page size property.

Good luck out there!

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Printer.PaperSize, Printer.PaperBin

2. Set the printer PaperBin and PaperSize

3. Printer Setting and PaperSize

4. Setting Printer PaperSize from VB5

5. Setting printer Papersize, Orientation Copies etc.

6. Setting Printer.PaperBin gives Error

7. How do I get PaperBin/PaperSize from ShowPrinter?

8. Get PaperSize from PaperBin ?

9. Getting the printer settings without initialising the printer?

10. Getting Printers and setting default

11. getting CommonDialog Printer Setup settings

12. getting rid of printer settings dialog

 

 
Powered by phpBB® Forum Software