You are not logged in.
Pages: 1
my code:
var
PDF: TPdfDocument;
R: TPdfRect;
R.Left := 30;
R.Top := 500;
R.Right := 100;
R.Bottom := 800;
PDF.Canvas.SetFont('Times New Roman', 12, []);
PDF.Canvas.MultilineTextRect(R, 'Welcome to mORMot Open Source', True);
Only the text 'Welcome to' is displayed, no other text is displayed.
Thanks.
Offline
It seems like you are misinterpreting some things.
First of all there are these lines in MultilineTextRect.
MoveToNextLine;
ARect.Top := ARect.Top - FPage.Leading;
if ARect.Top < ARect.Bottom + FPage.FontSize then
Break;
So the ARect.Top is decreasing with each line (by FPage.Leading which is default 0)
That means you have your Top and Bottom wrong.
Change them to Top := 800 and Bottom := 300; (the coordinates are from the bottom up)
Next... for the MoveToNextLine function to function you will need to set the Leading.
/// Set the text leading, Tl, to the specified leading value
// - leading which is a number expressed in unscaled text space units;
// it specifies the vertical distance between the baselines of adjacent
// lines of text
// - Text leading is used only by the MoveToNextLine and ShowTextNextLine methods
// - you can force the next line to be just below the current one by calling:
// ! SetLeading(Attributes.FontSize);
// - Default value is 0
procedure SetLeading(leading: Single); { TL }
So if you change your code to this it should work:
R.Left := 30;
R.Top := 800; // this is almost at the top of the page
R.Right := 100;
R.Bottom := 300; // needs to be lower than the top
PDF.Canvas.SetFont('Times New Roman', 12, []);
PDF.Canvas.SetLeading(12); // font size, for newline
PDF.Canvas.MultilineTextRect(R, 'Welcome to mORMot Open Source', True);
Offline
thank you,it works!
Offline
Pages: 1