You are not logged in.
Pages: 1
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
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
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
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
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!
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
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...
Pages: 1