I created a sample web application to convert any given pdf document to text. I got free utility pdftotext from xpdf
to perform this action. The positive thing about this utility is that it extract the pdf text and save into newly create text file without writing any extra code.
This utility required following command to execute to Convert the URL into PDF file.
here is some documentation about pdftotext
to upload the pdf file to executable directory (the text file will also save on same location)
private void Upload_PDF_File(string filename)
FU_Pdf.PostedFile.SaveAs(GetFilePath() +"\\"+ filename.Trim());
to create the above mentioned command, i wrote a method Construct_Command(...)
private void Construct_Command(string PDFPath)
string str_Command = string.Empty;
string PDF_Server_Path = GetFilePath() + "\\" + PDFPath;
str_Command = "pdftotext " + PDF_Server_Path;
//Execute command on pdftotext
To execute the above command on executable file, i wrote following method.
public void Execute_Command(string str_Command)
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + GetFilePath() + "\\" + str_Command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
Process proc = new Process();
proc.StartInfo = procStartInfo;
catch (Exception objException)
// Log the exception
I will post the desktop version very soon...
the complete code is attached. please feel free to ask questions.
I also attached the pdftotext documentation.