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

Free Support Forum - aspose.com

Unable to read text from memory stream


The code below will extract all text from my pdf file and save it to a text file. However, if I just to message out the content of the sr variable below, all I get is the first character of the pdf file. This probably something basic but I was hoping this forum could help me get past this issue.

Dim license As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License


'Instantiate PdfExtractor object

Dim extractor As PdfExtractor = New PdfExtractor()

extractor.ExtractTextMode = 0

' Instantiate a memoryStream object to hold the extracted text from Document

Dim ms As New MemoryStream()

'Set Password for input PDF file

extractor.Password = ""

'Bind the input PDF document to extractor


'Extract text from the input PDF document


'Save the extracted text memorystream


ms.Seek(0, SeekOrigin.Begin)

Dim sr As New StreamReader(ms, True)




Hi Rafael,

Please try to use the code snippet shown on this link to extract the text from PDF file. If you still find any issues, please share the sample PDF file with us, so we could test the issue at our end.

We’re sorry for the inconvenience.

Thanks! That worked for me.