Is there a function to extract the PDF or PDF page to a string?

Hello,

The Apose.pdf.kit allows you to extract the text of the PDF document to a file.

Is there a function to extract the PDF or PDF page to a string?

Von

Hi Von,

Thank you very much for considering Aspose.

You can extract text to a MemoryStream using GetText method of PdfExtractor class in Aspose.Pdf.Kit for .NET; you can then convert the data in the MemoryStream to String.

I hope this helps. If you have any further questions, please do let us know.
Regards,

The below only return blank lines what am I doing wrong?

Dim pageCount As Integer = 1

Dim currentpage As String

Dim extractor As PdfExtractor = New PdfExtractor()

extractor.BindPdf(PDFfilename)

extractor.ExtractText()

While extractor.HasNextPageText()

Dim mem As New MemoryStream()

extractor.GetNextPageText(mem)

Dim sr As New StreamReader(mem)

currentpage = Trim(sr.ReadToEnd())

sr.Close()

mem.Close()

currentpage.Replace(vbCrLf, """" & ", " & """")

writetodebugfile(currentpage & vbCrLf, 0)

pageCount = pageCount + 1

End While

End Function

Hi Von,

Your code looks fine; please share the sample PDF file you’re working with, so we could test the issue at our end.

We’re sorry for the inconvenience and appreciate your cooperation.
Regards,

How do I share with you the pdf?

What is your email?

Von

Hi Von,

You can either mark this post as private and then attach the file with it; Or you can send it using ‘Contact -> Send shahzad.latif an email’ option at the top of this post.

I hope this helps.
Regards,