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 set the PixelsPerInch property of a TPrinter 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
07-Oct-02
Category
Reporting /Printing
Language
Delphi 2.x
Views
67
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to set the PixelsPerInch property of a TPrinter

Answer:

When changing printers, be aware that fontsizes may not always scale properly. To 
ensure proper scaling, set the PixelsPerInch property of the font after changing 
the printer index property. Be sure not to make the change until you have started 
the print job.

Here are two examples:

1   uses
2     Printers;
3   
4   var
5     MyFile: TextFile;
6   begin
7     Printer.PrinterIndex := 2;
8     AssignPrn(MyFile);
9     Rewrite(MyFile);
10    Printer.Canvas.Font.Name := 'Courier New';
11    Printer.Canvas.Font.Style := [fsBold];
12    Printer.Canvas.Font.PixelsPerInch := GetDeviceCaps(Printer.Canvas.Handle,
13      LOGPIXELSY);
14    Writeln(MyFile, 'Print this text');
15    System.CloseFile(MyFile);
16  end;
17  
18  uses
19    Printers;
20  
21  begin
22    Printer.PrinterIndex := 2;
23    Printer.BeginDoc;
24    Printer.Canvas.Font.Name := 'Courier New';
25    Printer.Canvas.Font.Style := [fsBold];
26    Printer.Canvas.Font.PixelsPerInch := GetDeviceCaps(Printer.Canvas.Handle,
27      LOGPIXELSY);
28    Printer.Canvas.Textout(10, 10, 'Print this text');
29    Printer.EndDoc;
30  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