Page.AddTextFragment(String, Single, Single) Method
Adds an unformatted text fragment to the page.
Namespace: DevExpress.Docs.Pdf
Assembly: DevExpress.Docs.Pdf.v26.1.dll
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| text | String | The text to add. |
| x | Single | The x-coordinate on the page where the text fragment is inserted. |
| y | Single | The y-coordinate on the page where the text fragment is inserted. |
Returns
| Type | Description |
|---|---|
| TextFragment | The added text fragment. |
Remarks
Example: How to Add Text to a PDF Document Page
The following code snippet adds text to a PDF document page:
using DevExpress.Docs.Pdf;
using DevExpress.Drawing.Printing;
using System.Drawing;
using DevExpress.Drawing;
using System.IO;
using (PdfDocument pdfDocument = new PdfDocument()) {
var page = pdfDocument.Pages.Add(DXPaperKind.A4);
var text = "The PDF Document API is a non-visual .NET library that allows you to " +
"generate, convert, merge, split, edit, password-protect, and digitally " +
"sign PDF files.";
page.AddTextFragment(text, 10, 740);
pdfDocument.Save(new FileStream("Result.pdf", FileMode.Create, FileAccess.Write));
}
See Also