Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to check if a printer supports postscript Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
26-Mar-04
Category
Reporting /Printing
Language
Delphi 2.x
Views
123
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Peter Below

How to check if a printer supports postscript?

Answer:

That is really difficult do to if it has to work on all Windows platforms. The best 
way (no kidding) may be to ask the user which printer to use. What platforms do you 
need to support? If it is only Win2K (and perhaps XP) one may be able to use this 
(i have no postscript-enabled printer around to see if it works!): 

1   uses
2     WinSpool, Printers;
3   
4   {: Check if the currently selected printer supports postscript.
5     Only applicable on Win2K/XP! }
6   
7   function PrinterSupportsPostscript: Boolean;
8   const
9     POSTSCRIPT_PASSTHROUGH = 4115;
10    POSTSCRIPT_IDENTIFY = 4117;
11  
12    Escapes: array[0..2] of Cardinal =
13    (POSTSCRIPT_DATA, POSTSCRIPT_IDENTIFY, POSTSCRIPT_PASSTHROUGH);
14  var
15    res: Integer;
16    i: Integer;
17  begin
18    Result := false;
19    for i := Low(Escapes) to High(Escapes) do
20    begin
21      res := ExtEscape(printer.Handle,
22        QUERYESCSUPPORT,
23        sizeof(Escapes[0]),
24        @Escapes[i], 0, nil);
25      if res <> 0 then
26      begin
27        Result := true;
28        Break;
29      end;
30    end;
31  end;
32  
33  procedure TForm1.Button1Click(Sender: TObject);
34  const
35    boolstr: array[Boolean] of string = (' not', '');
36  var
37    i: Integer;
38    S: string;
39  begin
40    for i := 0 to Printer.Printers.Count - 1 do
41    begin
42      Printer.PrinterIndex := i;
43      memo1.Lines.add(
44        Format('Printer %s does%s support Postscript',
45        [printer.printers[printer.printerindex],
46        boolstr[PrinterSupportsPostscript]]));
47    end;
48  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC