Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pagerect and Richedit

Posted on 1997-10-11
5
Medium Priority
?
1,061 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 400 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 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