Solved

Pagerect and Richedit

Posted on 1997-10-11
5
1,049 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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