Declaration
procedure AddText(X: double; Y: double; const Text: String;
FontSize: double = 18; const FontName: WideString = 'Times-Roman';
Rotation: double = 0; FillColor: TColor = clBlack; FillOpacity: double = 1.0;
BorderColor: TColor = clBlack; BorderOpacity: double = 1.0;
RenderingMode: TIEPDFRenderingMode = iepdfFillText; LineWidth: double = 1); overload;
procedure AddText(X: double; Y: double; const Text: String; FontSize: double = 18; Font: TFont;
Rotation: double = 0; Opacity: double = 1.0); overload;
procedure AddText(Rect: TRect; const Text: String; FontSize: double; Font: TFont;
Rotation: double = 0; Opacity: double = 1.0);
Description
Adds text to the current page.
Parameter | Description |
X, Y | Position of the text (in Adobe points) |
Text | Text to add (only Western characters are supported at this time) |
FontSize | Size of font (in Adobe points) |
FontName | Name of the font. Must be one of the standard PDF fonts listed below |
Rotation | Rotation of text (around center) |
FillColor | Color of text fill |
FillOpacity | Opacity of text fill (0: Fully Transparent to 1.0: Fully opaque) |
BorderColor | Color of the text outline |
BorderOpacity | Opacity of text outline (0: Fully Transparent to 1.0: Fully opaque) |
RenderingMode | How text should be rendered |
LineWidth | Width of text line (in Adobe points) |
Note:
◼At this time, only
standard PDF fonts are supported: 'Times-Roman', 'Times-Bold', 'Times-Italic', 'Times-BoldItalic', 'Helvetica', 'Helvetica-Bold', 'Helvetica-Oblique', 'Helvetica-BoldOblique', 'Courier', 'Courier-Bold', 'Courier-Oblique', 'Courier-BoldOblique', 'Symbol', 'ZapfDingbats'
◼With second overload, a standard font will be selected based on that
Font.Name and
Font.Style.
Font.Color will be used for all color values (
Font.Size is NOT used)
◼"Current Page" is the page that has just been
added or set using
CurrentPageIndex | Demos\PDF\PDFBuilder2\PDFBuilder2.dpr |
// Add text to current page, at coordinates (0, 100), using Times-Roman at size 36
pdf.AddText( 0, 100, 'Rotated Text', 36, 'Times-Roman');
// Add filled and stroked text, using transparency
pdf.AddText( 0, 150, 'Filled and stroked text', 36, 'Helvetica-Bold', 0, clGreen, 0.2, clRed, 0.8, iepdfFillStroke);
See Also
◼AddEllipse◼AddImage◼AddLinePath◼AddShape