You are not logged in.
Pages: 1
Working with Delphi 10.
I started to create a PDF document, it works ok so far.
Then I tried to create a hyperlink over part of the text, by calling CreateHyperling with the right parameters. When I open the pdf doc, the cursor changes as expected when passing over the text, but nothing happens when I click. Did I miss something?
Thanks
Offline
There is a bug and it was mentioned multiple times here, but somehow it is still not fixed. I am not sure why. Maybe the authors refuse to fix this? They never answered as far as I know.
Offline
Well, my last pull request was not merged for over a month without a comment: https://github.com/synopse/mORMot/pull/296
Why would I provide another?
Offline
I am using Delphi Alexander and have SynPDF working but I need to create a PDF document with a HyperLink (URL) please advise - thanks
Offline
procedure TForm1.Button1Click(Sender: TObject);
var
lPdf : TPdfDocument;
lPage : TPdfPage;
begin
lPdf := TPdfDocument.Create;
try
lPdf.Info.Author := 'Tester';
lPdf.Info.CreationDate := Now;
lPdf.Info.Creator := 'Tester';
lPdf.DefaultPaperSize := psA4;
lPage := lPDF.AddPage;
lPdf.Canvas.SetFont('Helvetica',10.0,[]);
lPdf.Canvas.SetLeading(lPDF.Canvas.Page.FontSize);
lPdf.Canvas.SetLineWidth(0.1);
lPdf.Canvas.BeginText;
lPdf.Canvas.TextOut( 300, 700, 'This is some text.');
lPdf.Canvas.EndText;
lPdf.CreateHyperLink(); // NO SUCH FUNCTION - What Have I missed ?
lPdf.SaveToFile('....\test.pdf');
finally
lPdf.Free;
end;
end;
Offline
Version 1.18.613
Offline
OK, found a later version 1.18.6439 - CreateHyperLink Exists.
Is there an easy way to calculate the text height for TPdfRect ?
procedure TForm1.Button1Click(Sender: TObject);
var
lPdf : TPdfDocument;
lPage : TPdfPage;
r : TPdfRect;
begin
r.Left:= 300;
r.Top:= 700;
r.Right:= 500;
r.Bottom:= 750;
lPdf := TPdfDocument.Create;
try
lPdf.Info.Author := 'Tester';
lPdf.Info.CreationDate := Now;
lPdf.Info.Creator := 'Tester';
lPdf.DefaultPaperSize := psA4;
lPage := lPDF.AddPage;
lPdf.Canvas.SetFont('Helvetica',10.0,[]);
lPdf.Canvas.SetLeading(lPDF.Canvas.Page.FontSize);
lPdf.Canvas.SetLineWidth(0.1);
lPdf.Canvas.BeginText;
lPdf.Canvas.TextOut( 300, 700, 'Axfite Pty Ltd.');
// lPdf.Canvas.EndText;
lPdf.CreateHyperLink(r, 'https://axfite.com.au', abSolid, 1);
lPdf.Canvas.EndText;
lPdf.SaveToFile('....\test.pdf');
finally
lPdf.Free;
end;
end;
Also, why did rect border line not paint ?
Last edited by andyhill (2022-12-03 07:28:33)
Offline
The problem is in r.Top > r.Bottom if you put
r.Left:= 300;
r.Top:= 750;
r.Right:= 500;
r.Bottom:= 700;
On PdfCanvas, 0 is bottom and 852 is top
Offline
Pages: 1