Class LineTextObject
Represents a single line of text within a PDF page, combining multiple text chunks. Provides access to line content, bounding box, and positioning information.
Lines are derived from TextChunks by grouping text objects that appear on the same visual line based on their vertical position.
Example - Extract lines from a page:
var pdf = PdfDocument.FromFile("document.pdf");
var page = pdf.Pages[0] as PdfPage;
foreach (var line in page.Lines)
{
Console.WriteLine($"Line: {line.Contents}");
Console.WriteLine($"Position: ({line.BoundingBox.Left}, {line.BoundingBox.Top})");
}
Implements
Inherited Members
Namespace: IronPdf.Pages
Assembly: IronPdf.dll
Syntax
public class LineTextObject : TextObject, IPdfTextObject, IPdfDocumentObject
Use LineTextObject in IronPDF when a C# application works with PDF pages. It represents a single line of text within a PDF page, combining multiple text chunks.
LineTextObject matters when an application needs to configure or invoke PDF pages from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use LineTextObject, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key methods include ToJson. Assign options or invoke methods on the instance to configure or perform the operation. The extract text and images covers typical usage in C# end to end.
using IronPdf;
// Obtain LineTextObject from the relevant entry point in the IronPDF API
void Configure(LineTextObject instance)
{
instance.ToJson();
}For the broader workflow, see the access PDF DOM object guide in the IronPDF C# documentation. For broader context, the PDF pages portion of the IronPDF C# API contains related types that work with LineTextObject directly. LineTextObject instances inherit additional members from TextObject that may be relevant in advanced scenarios. In application code, treat LineTextObject as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant LineTextObject property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of LineTextObject. Application code typically obtains or instantiates a single LineTextObject and shares it across multiple IronPDF operations rather than recreating it per call.
Methods
ToJson()
Serializes this line text object to JSON format.
Declaration
public string ToJson()
Returns
| Type | Description |
|---|---|
| System.String | JSON string representation of this line. |
Exceptions
| Type | Condition |
|---|---|
| System.NotImplementedException | This method is not yet implemented. |