#1 Re: PDF Engine » CreateHyperLink function » 2022-12-03 04:40:21

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 ?

#3 Re: PDF Engine » CreateHyperLink function » 2022-12-03 04:06:09

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;

#4 Re: PDF Engine » CreateHyperLink function » 2022-12-01 20:28:48

I am using Delphi Alexander and have SynPDF working but I need to create a PDF document with a HyperLink (URL) please advise - thanks

Board footer

Powered by FluxBB