You are not logged in.
Pages: 1
Although Delphi (10.3.2) acknowledges the procedure TextRect exists, it won't compile. It stops on
lpdf.VCLCanvas.TextRect(R, 'Now is the time for all good men', [tfCenter]);
with the error message: [dcc32 Error] Unit1.pas(66): E2250 There is no overloaded version of 'TextRect' that can be called with these arguments
I've tried it with different values for TextFormat with the same result. My rect is declared as TPDFRect. My version of SynPDF.pas is dated 3/13/2020.
What's the problem?
Offline
Thanks. But using TRect produces the same compile error: [dcc32 Error] Unit1.pas(67): E2250 There is no overloaded version of 'TextRect' that can be called with these arguments
Offline
The problem is in the string, not in TRect.
See the declaration of this method in the vcl.Graphics unit (which has no relation to SynPdf)
procedure TCanvas.TextRect(var Rect: TRect; var Text: string; TextFormat: TTextFormat = []);
The "Text" param is "var". So you can't pass a constant.
Try
var
MyText : String;
begin
MyText := 'Now is the time for all good men';
lpdf.VCLCanvas.TextRect(R,MyText, [tfCenter]);
...
end;
Offline
Thanks. That was it.
Offline
Pages: 1