#1 Re: PDF Engine » CreateHyperLink function » 2023-07-10 23:02:21

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

#2 Re: PDF Engine » How to add a simple hyperlink in a PDF document? » 2023-07-10 22:59:09

The problem is in rect.Top > rect.Bottom if you put

    TPdfRect rect;
    rect.Left   = 0;
    rect.Top    = 50;
    rect.Right  = 50;
    rect.Bottom = 0;

On PdfCanvas, 0 is bottom and 852 is top

#3 Re: PDF Engine » How can I write 90º rotated text with the TPDFCanvas? » 2023-06-30 09:29:19

Finally, I found how works...

  var a := angle*(PI/180);
  var c := Cos(a);
  var s := Sin(a);
  pdf.Canvas.SetFont('Arial', 11, []);
  pdf.Canvas.BeginText;
  pdf.Canvas.SetTextMatrix(c, s, -s, c, 200, 200);
  pdf.Canvas.ShowText('ROTATED TEXT');
  pdf.Canvas.EndText;

Only works with ShowText (with TextOut not).

And BeginText, EndText is important too

#4 Re: PDF Engine » How to render rotated text ? » 2023-06-28 23:04:41

With this changes, it works!

      var a := rotation*(PI/180);
      var c := Cos(a);
      var s := Sin(a);
      pdf.Canvas.BeginText;
      if centered then begin
         X := X + pdf.DefaultPageWidth div 2;
         Y := Y + pdf.DefaultPageHeight div 2;
      end;
      pdf.Canvas.SetTextMatrix(c, s, -s, c, X, Y);
      pdf.Canvas.ShowText(text); 
      pdf.Canvas.EndText;

BeginText BEFORE SetTextMatrix
and ShowText for write the Text

#5 PDF Engine » How can I write 90º rotated text with the TPDFCanvas? » 2023-06-28 22:13:51

surfzone
Replies: 1

I think that I need to use PDF.Canvas.SetTextMatrix, but I cannot find any example to show how it works...

Anyone can put an example?

Thanks!

#6 Re: PDF Engine » How to change the icon and the format of an Annotation? » 2023-06-26 19:35:45

The icon is solved, added this types in synPDF.pas (there's only defined asTextNotes and asLink)

  /// The annotation types determines the valid annotation subtype of TPdfDoc
  TPdfAnnotationSubType = (
    asTextNotes, asLink, asSound, asFreeText, asStamp, asSquare, asCircle,
    asStrikeOut, asHighlight, asUnderline, asInk, asFileAttachment, asPopup);

changed with

  var an := Pdf.CreateAnnotation(asSquare, PdfRect(40, 40, 80, 80, abInset, 0));
  an.AddItem('Contents', TPdfText.Create('Contents example text');
  an.AddItem('Open', TPdfBoolean.Create(true));

The internal code for news type are OK, but the type was not defined...

Now, I like to change the design of the annotation text

#7 PDF Engine » How to change the icon and the format of an Annotation? » 2023-06-26 18:12:03

surfzone
Replies: 1

I create an annotation with this code

  var an := Pdf.CreateAnnotation(asTextNotes, PdfRect(40, 40, 80, 80));
  an.AddItem('Contents', TPdfText.Create('Contents example text');
  an.AddItem('S', TPdfText.Create('S'));
  an.AddItem('Open', TPdfBoolean.Create(true));

This creates a ballon that shows the text, but I like to change the icon and format that text... (I like to simulate a "hint" into the PDF).

Note: There are any documentation about annotations? I copied this 3 lines from searching "CreateAnnotation(asTextNotes" on Google...

Board footer

Powered by FluxBB