Solved

Pagerect and Richedit

Posted on 1997-10-11
5
1,036 Views
Last Modified: 2013-11-22
A while ago I found this code for printing with Richedit, but if I use it as below only have a page gets printed, and then a new one starts, and I only got to specify left and topmargin. Can you please show me how the correct settings should be for a standard A4 page with a leftmargin of 10mm, Topmargin 20mm, Bottommargin also 20mm and rightmargin of 15mm, please write it so That it works Immediate if I paste it in my code Thanks.


RichEdit1.PageRect := Rect(100, 100, Printer.PageHeight, Printer.PageWidth);
RichEdit1.Print(...);
0
Comment
Question by:hellfire052497
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
ID: 1347280
var
 Loff, TOff, ROff, BOff   : integer;
 XRes, YRes, XOffs, YOffs : integer;
begin
  { set your needed values in milimeters }
  LOff := 10;
  TOff := 20;
  ROff := 15;
  BOff := 20;
  { Get printer data }
  XOffs := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX ); { minimum Left offset }
  YOffs := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY ); { minimum Top offset }
  XRes := GetDeviceCaps(Printer.Handle, LOGPIXELSX); { points per inch in X }
  YRes := GetDeviceCaps(Printer.Handle, LOGPIXELSY); { points per inch in Y }
  {Change Your values to printer Units }
  LOff := Round(LOff*XRes/25.4)-XOffs; { of course You can't set margins less than min offset !!! }
  TOff := Round(TOff*YRes/25.4)-YOffs; { of course You can't set margins less than min offset !!! }
  ROff := 2490-Round(ROff*XRes/25.4)-XOffs; { changing to width, not offset !!!}
  BOff := 3510-Round(BOff*YRes/25.4)-YOffs; { changing to height, not offset !!!}
  { print RichEdit }
  RichEdit1.PageRect := Rect( LOff, TOff, ROff, BOff );
  RichEdit1.Print( 'TEST A4 ' );
end;

0
 

Author Comment

by:hellfire052497
ID: 1347281
I just noticed that this code is skipping a lot of text about half a page between printed pages, and also that the text when reaching the right margin doesn't get printed and gets lost.
thus giving a lot of clipping. so it isn't correct just yet
please check what is wrong
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1347282
Ok. I will try to test this. Wait to tomorrow.
0
 

Author Comment

by:hellfire052497
ID: 1347283
for your information I use richedit in a fixed size of;
Height : 257
Width: 593

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1347284
Sorry for the long time.
In My exampele all works fine. Can you send me your example ? Mayby I found what is going on.
mirek@izabell.itcomp.tpnet.pl
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 64
Delphi XE10, MySQL Query 4 143
Delphi : could not find program, '...exe' 2 171
Twebbrowser in Fire monkey android scrolling to bottom 1 30
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question