Alex Rivera | Logout

Convert a pdf file to text in C#

Asked 2009-12-22T06:50:31.110
10

I need to convert a .pdf file to a .txt file

How can I do this in C#?

Edit
Report

2 Answers

5

Ghostscript could do what you need. Below is a command for extracting text from a pdf file into a txt file (you can run it from a command line to test if it works for you):

gswin32c.exe -q -dNODISPLAY -dSAFER -dDELAYBIND -dWRITESYSTEMDICT -dSIMPLE -c save -f ps2ascii.ps "test.pdf" -c quit >"test.txt"

Check here: codeproject: Convert PDF to Image Using Ghostscript API for details on how to use ghostscript with C#

answered 2009-12-23T04:53:30.157
1

As an alternative to Don's solution there I found the following:

Extract Text from PDF in C# (100% .NET)

answered 2011-02-11T04:23:32.383

Your Answer