Articles   Members Online: 3
-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 set the printer paper size (2) 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
21-Nov-02
Category
Reporting /Printing
Language
Delphi 2.x
Views
133
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How I can select the printer's papersource through code? How I can read the printer 
default setting papersource in my Delphi program?

Answer:

1   { ... }
2   var
3     aDrvName, aPrtName, aPortName: array[0..127] of Char;
4     aDeviceMode: THandle;
5     PDevMode: ^TDevMode;
6     i: Integer;
7   begin
8     with Printer do
9     begin
10      GetPrinter(aDrvName, aPrtName, aPortName, aDeviceMode);
11      PDevMode := GlobalLock(aDeviceMode);
12      try
13        if PDevMode^.dmPaperSize = DMPAPER_A4 then
14          ShowMessage('A4')
15        else if PDevMode^.dmPaperSize = DMPAPER_A3 then
16          ShowMessage('A3')
17        else
18        begin
19          ShowMessage('Size not supported!' + #13 + 'Resetting papersize to A4');
20          PDevMode^.dmPaperSize := DMPAPER_A4;
21        end;
22      finally
23        GlobalUnlock(aDeviceMode);
24      end;
25    end;
26  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