We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Line Count

Hi - just one final question hopefully regarding the software. basically it can do almost everything i need except for a line count. i was wondering if there is a way that i can read my newly created (using aspose pdf) PDF back in and do a search or count of lines in the document? ive had a look at the TextFragmentCollection and searching for words in the text but ideally i need this to loop each line. can you help me? if i can resolve this im fairly happy that i can make a purchase.

thanks


to add to this issue i thought that i could add a marker at the start and a marker at the end of the pdf document. i could then use the following from the fragmenter logic to find my starting position and my end position then work out the space between. it appears to give some strange values though - can u help ? i really need this before i can purchase.

fun_ReadText = 0.0
Dim pdfDocument As New Document(SaveLocation)


Dim textFragmentAbsorber As New Aspose.Pdf.Text.TextFragmentAbsorber(Text)
'accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber)
'get the extracted text fragments
Dim textFragmentCollection As Aspose.Pdf.Text.TextFragmentCollection = textFragmentAbsorber.TextFragments
'loop through the fragments
Dim Position As Double

For Each textFragment As Aspose.Pdf.Text.TextFragment In textFragmentCollection

Dim textseg As String = textFragment.Text
Position = textFragment.Position.XIndent
Dim yindent As String = textFragment.Position.YIndent



Next textFragment

pdfDocument = Nothing
fun_ReadText = Position

Hi Colin,


Thanks for contacting support and sorry for the delayed response.

I am afraid currently we do not have the feature to count number of lines in PDF document. However you can convert PDF file to Word format using Aspose.Pdf for .NET by following instructions over Convert PDF file to DOC or DOCX format and then try using Aspose.Words for .NET to get number of lines in DOC/DOCX file. You can use the Document.BuiltInDocumentProperties.Lines property to get number of lines in the document. MS Word calculates the number of lines and stores this value in this built-in document property.

We are sorry for this inconvenience.