C# MemoryStream (Aspose.Pdf.Kit.Extractor(stream) to text box)

I am using the Pdf.Kit to extract text from a pdf.

I can make the extractor.GetText(outputFile) to work, but I would like to be able to return the text to the screen in a text box.

Can you help please?

Thanks

Rob

private void convertPDF(string inputName, string outputName, int txtMode)

{

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense(@"C:\Program Files\Aspose\Aspose.Pdf.Kit for .Net\bin\net35\Aspose.Pdf.Kit.lic");

MemoryStream outputTxt = new MemoryStream();PdfExtractor extractor = new PdfExtractor();

extractor.BindPdf(inputName);

extractor.ExtractTextMode = txtMode;

extractor.ExtractText();

extractor.GetText(outputName);

extractor.GetText(outputTxt);

StreamReader streamReader = new StreamReader(outputTxt);string result = "";

result = streamReader.ToString();

result = result + streamReader.ReadToEnd();

textBox1.Text = result;

streamReader.Close();

outputTxt.Close();

}


This message was posted using Aspose.Live 2 Forum

Hi Rob,

You can find the details along with the examples at this link. This code will help you extract the text in a string variable and you’ll be able to assign this string to a TextBox control.

If you think it doesn’t resolve your issue or you find any other problem then please share the sample PDF file with us, so we could test the issue at our end.

We’re sorry for the inconvenience.
Regards,