Convert PDF to TEXT using C# | Aspose.Words for .NET

I tried to load a pdf into the Doc variable. It throws an error UnsupportedFileFormatException. All I want to do is load up a PDF and get the output as text. Am I able to do so with Aspose.Word? The code below is what I have used. I have attached the sample resume being used.

Stream stream = new MemoryStream(attachmentData.Data);

Document doc = new Document(stream);

Thanks.

Hi

Thanks for your inquiry. You cannot open PDF using Aspose.Words. Aspose.Words supports only export to PDF.

If you need to get text from the PDF document, you can try using Aspose.PDF for .NET API. Please see the following link for more information:

In addition, you can try using Aspose.PDF for .NET API to get text from PDF document. You can download Aspose.PDF for .NET API from here:

hope this helps.
Best regards.

@odez909

The latest version of Aspose.Words does support import of PDF. Please install the latest version of Aspose.Words for .NET through NuGet and convert the PDF to TXT format as shown below.

Document doc = new Document("input.pdf");
doc.Save("output.txt");