Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to find out what paper is in printer tray
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01243458
Message ID:
01243464
Views:
24
>I have a report that can print to multiple trays. However sometimes one of the trays can have different size paper in it. I would like to print a different report based on the size in the tray.
>
>i.e. if A4 paper is in tray print the report for A4 sized paper
>or
>if letter paper is in the tray, print the report for letter sized paper.
>
>So to do this, I need to know what kind of paper is in the tray.
>
>Is there a way to query the printer for this information?
>
>The printer is an HP laser, and on a network, setup as a tcp/ip printer.
>
>Thanks,
>Mike

I think this could not be of any use for the particular problem, but anyway, here is a script to get some printer's properties:
strComputer = "."
objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + strComputer + "\root\cimv2")

colInstalledPrinters =  objWMIService.ExecQuery ("Select * from Win32_PrinterConfiguration")

For Each objPrinter in colInstalledPrinters
    try
    ? "Name: " , objPrinter.Name
    ? "Collate: " , objPrinter.Collate
    ? "Copies: " , objPrinter.Copies
    ? "Driver Version: " , objPrinter.DriverVersion
    ? "Duplex: " , objPrinter.Duplex
    ? "Horizontal Resolution: " , objPrinter.HorizontalResolution
    
    If objPrinter.Orientation = 1 Then
        strOrientation =  "Portrait"
    Else 
        strOrientation = "Landscape"
    EndIf
    ? "Orientation : " , strOrientation
    ? "Paper Length: " , objPrinter.PaperLength / 254
    ? "Paper Width: " , objPrinter.PaperWidth / 254
    ? "Print Quality: " , objPrinter.PrintQuality
    ? "Scale: " , objPrinter.Scale
    ? "Specification Version: " , objPrinter.SpecificationVersion
    DO case
      case objPrinter.TTOption = 1 
        strTTOption = "Print TrueType fonts as graphics."
    case objPrinter.TTOption = 2 
        strTTOption = "Download TrueType fonts as soft fonts."
    otherwise
        strTTOption = "Substitute device fonts for TrueType fonts."
    ENDCASE
    
    ? "True Type Option: " , strTTOption
    ? "Vertical Resolution: " , objPrinter.VerticalResolution
    CATCH TO loExc
    endtry
Next
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform