' Return True if this is a PostScript printer.
Private Function PrinterIsPostScript() As Boolean
Dim escape As Long
Dim technology As String
' See if the printer is using the generic
' PostScript driver.
If LCase$(Printer.DriverName) = "pscript" Then
PrinterIsPostScript = True
Exit Function
End If
' See if it supports POSTSCRIPT_PASSTHROUGH.
escape = POSTSCRIPT_PASSTHROUGH
If ExtEscape(Printer.hdc, QUERYESCSUPPORT, _
Len(escape), escape, 0, ByVal 0&) > 0 _
Then
' It supports POSTSCRIPT_PASSTHROUGH.
' It's a PostScript printer.
PrinterIsPostScript = True
Exit Function
End If
' See if it supports GETTECHNOLOGY.
escape = GETTECHNOLOGY
If ExtEscape(Printer.hdc, QUERYESCSUPPORT, _
Len(escape), escape, 0, ByVal 0&) <= 0 _
Then
' It doesn't support GETTECHNOLOGY.
' We cannot tell so assume it's not a
' PostScript printer.
PrinterIsPostScript = False
Exit Function
End If
' Get the technology string.
'and check to see if the word "postscript" is in it.
technology = Space$(MAX_PATH + 1)
If ExtEscape(Printer.hdc, GETTECHNOLOGY, _
0, ByVal 0&, MAX_PATH, GETTECHNOLOGY) <= 0 _
Then
' We didn't get a value.
' Assume it's not a PostScript printer.
PrinterIsPostScript = False
Exit Function
End If
' See if the technology string contains the
' word PostScript.
technology = LCase$(Left$(technology, InStr(technology, _
vbNullChar)))
PrinterIsPostScript = InStr(technology, "postscript") > _
0
End Function
|