RichViewEdit - margin - printout

General TRichView support forum. Please post your questions here
Post Reply
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

RichViewEdit - margin - printout

Post by Crowbar »

Hi,
I use the paper format A4 (210 mm x 297 mm).
In my RichViewEdit i to fix the left- and right margin at 20mm:

Code: Select all

...
function MMToPixels(mm: Integer): Integer;
var ppi: Integer;
begin
  ppi:=RichViewPixelsPerInch;
  if ppi = 0 then ppi:=Screen.PixelsPerInch;
  Result:=Round(mm * 5 * ppi / 127);
end;
...
RichViewEdit1.LeftMargin:=MMToPixels(20);
RichViewEdit1.RightMargin:=MMToPixels(20);
RichViewEdit1.MaxTextWidth:=MMToPixels(210)-RichViewEdit1.LeftMargin-RichViewEdit1.RightMargin;
RichViewEdit1.Format;
...
procedure TForm1.PrintPreviewButtonClick(Sender: TObject);
begin
  RVPrint1.AssignSource(RichViewEdit1);
  RVPrint1.LeftMarginMM:=0;
  RVPrint1.RightMarginMM:=0;
  RVPrint1.TopMarginMM:=0;
  RVPrint1.BottomMarginMM:=0;
  RVPrint1.HeaderYMM:=0;
  RVPrint1.FooterYMM:=0;
  RVPrint1.FormatPages(rvdoALL);
  RVPrintPreview1.First;
end;
...
The RVRuler in the RichViewEdit showing the margins correkt.
But the printpreview and the printout margins are approximate 25mm instead of 20mm (left-margin and right-margin).

Where is my bug? :?

Crowbar
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Zero margins of TRVPrint are not possible. There are minimal margins values supported by printer. If RVPrint's margins are too small, it uses minimal values supported by the printer instead.

Ok, in the next update I'll add a new property to TRVPrint allowing to turn off margins correction.
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post by Crowbar »

Hi Sergey,
thanks for your informations.
I will waiting to the next update. :P

Crowbar
Post Reply