Free Support Forum -

Aspose.Pdf.Devices.TextDevice.Process To Stream Fails

textDevice.Process FAILS
the object browser and documentation state IO.Steam
but in code it wants string

foreach (Page pdfPage in aPdf.Pages)
using (MemoryStream ms = new MemoryStream())
//create text device
Aspose.Pdf.Devices.TextDevice textDevice = new Aspose.Pdf.Devices.TextDevice();

//set text extraction options - set text extraction mode (Raw or Pure)
//Aspose.Pdf.Text.TextOptions.TextExtractionOptions textExtOptions = new Aspose.Pdf.Text.TextOptions.TextExtractionOptions(Aspose.Pdf.Text.TextOptions.TextFormattingOptions.t

textDevice.ExtractionOptions = new Aspose.Pdf.Text.TextOptions.TextExtractionOptions(Aspose.Pdf.Text.TextOptions.TextExtractionOptions.TextFormattingMode.Raw);
//convert a particular page and save text to the stream
textDevice.Process(pdfPage, ms);

//close memory stream

//get text from memory stream
//extractedText = Encoding.Unicode.GetString(textStream.ToArray());


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 7.6.0 over Windows 7 X64 where I have used one of my sample PDF file and as per my observations, I am unable to notice any problem. Can you please share the PDF documents which you are using so that we can test the scenario at our end. We are sorry for this inconvenience.

The problem was with Page.
It was referring to a .NET Page control.

When I used the Aspose.Pdf.Page pdfPage it worked



I am glad to hear that your problem is resolved. Please continue using our products and in case of any further query, please feel free to contact.