Contains information about a text item in a PDF page.
[SerializableAttribute()]public struct PDFTextProperties : System.ValueType
<SerializableAttribute()>Public Structure PDFTextPropertiesInherits System.ValueType
public class PDFTextProperties[SerializableAttribute()]public value class PDFTextProperties : public System.ValueType
The PDFTextProperties structure is used as the type of the following properties:
This structure contains font information of the text such as its font width, height and index, text position(represent whether the text item is the last item in a word or a line) and the text color.
This example reads the objects of a PDF file and creates a file on disk containing the text of the file. For an example that draws the PDF to an image, refer to PDFObject.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.PdfImports Leadtools.WinFormsImports Leadtools.DrawingPublic Sub PDFTextPropertiesExample()Dim pdfFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")Dim txtFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_txt.txt")' Create a PDF document for fileUsing document As PDFDocument = New PDFDocument(pdfFileName)' Parse the text of all the pagesdocument.ParsePages(PDFParsePagesOptions.Fonts Or PDFParsePagesOptions.Objects Or PDFParsePagesOptions.Fonts, 1, -1)' Output the words to the txt fileUsing writer As StreamWriter = File.CreateText(txtFileName)For Each page As PDFDocumentPage In document.PagesDim line As StringBuilder = New StringBuilder()For Each obj As PDFObject In page.ObjectsIf obj.ObjectType = PDFObjectType.Text Thenline.Append(obj.Code)If obj.TextProperties.IsEndOfLine Thenwriter.WriteLine(line)line = New StringBuilder()End IfEnd IfNext objNext pageEnd UsingEnd UsingEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Pdf;using Leadtools.WinForms;using Leadtools.Drawing;public void PDFTextPropertiesExample(){string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf");string txtFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_txt.txt");// Create a PDF document for fileusing(PDFDocument document = new PDFDocument(pdfFileName)){// Parse the text of all the pagesdocument.ParsePages(PDFParsePagesOptions.Fonts | PDFParsePagesOptions.Objects | PDFParsePagesOptions.Fonts, 1, -1);// Output the words to the txt fileusing(StreamWriter writer = File.CreateText(txtFileName)){foreach(PDFDocumentPage page in document.Pages){StringBuilder line = new StringBuilder();foreach(PDFObject obj in page.Objects){if(obj.ObjectType == PDFObjectType.Text){line.Append(obj.Code);if(obj.TextProperties.IsEndOfLine){writer.WriteLine(line);line = new StringBuilder();}}}}}}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: PDFTextProperties Structure - Leadtools.Pdf |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.