Method DrawText
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
DrawText(string, double, double, PdfFont, double, PdfColor?)
Draws a single line of text with its baseline starting at (x, y). Text is not wrapped.
public ContentStreamWriter DrawText(string text, double x, double y, PdfFont font, double size, PdfColor? color = null)
Parameters
textstringThe text. With a standard font it must be encodable in WinAnsiEncoding; with a TrueType font every character needs a glyph.
xdoublex of the start of the baseline, in points.
ydoubley of the baseline, in points.
fontPdfFontA StandardFont or TrueTypeFont.
sizedoubleFont size, in points.
colorPdfColor?Text colour; null keeps the current fill colour (black by default).
Returns
Remarks
Text is kerned and shaped with the TrueType font's layout tables (ligatures, joined Arabic letters, marks placed on their letters), and right-to-left text such as Hebrew and Arabic is reordered, as described for ShowText(string); TextDirection sets the base direction. Use MeasureText(string, double) to right-align or centre text.
Exceptions
- ArgumentException
The font cannot show a character of
text.- InvalidOperationException
Called inside a text object, or a standard 14 font is used in a PDF/A document.