Hi , i want to extract text from PDF file line by line. Written below code for that. Except header “Maintenance” I can get all the text line by line. I have attached PDF. Can you please help me with this?
Test.pdf (83.0 KB)
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@“Test.pdf”);
foreach (Aspose.Pdf.Page pdfPage in doc.Pages)
{
Aspose.Pdf.Text.TextSearchOptions options = new Aspose.Pdf.Text.TextSearchOptions(true);
Aspose.Pdf.Text.TextFragmentAbsorber absorber = new Aspose.Pdf.Text.TextFragmentAbsorber();
pdfPage.Accept(absorber);
Aspose.Pdf.Text.TextFragmentCollection collection = absorber.TextFragments;
foreach (Aspose.Pdf.Text.TextFragment oneTextFragment in collection)
{
string text = oneTextFragment.Text;//not a row
Console.WriteLine(String.Format("Extracted Text = '{0}'", text));
}
}