Reputation: 9445
string ghostScriptPath = @"C:\Program Files (x86)\gs\gs9.09\bin\gswin32.exe";
string inputFileName = Server.MapPath("pdf/myprofile.pdf");
string outputFileName = @"D:\";
string ars = "-dNOPAUSE -sDEVICE=jpeg -r300 -o" + output + "-%d.jpg " + input;
Process proc = new Process();
proc.StartInfo.FileName = ghostScriptPath;
proc.StartInfo.Arguments = ars;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
I'm using asp.net application with c# language. I'm using the code above to convert the PDF to images using Ghost Script. Is it possible to retain Hyperlinks from PDF?
Upvotes: 1
Views: 130
Reputation: 9401
You can use PDFParser to read the PDF as text (into a string) and then parse the string yourself for "http". Just for completeness:
// create an instance of the pdfparser class
PDFParser pdfParser = new PDFParser();
// extract the text
String result = pdfParser.ExtractText(pdfFile);
if(result.ToLower().Contains("http"))
{
//split the string on known factors like a "\n" and "/" for ending the url.
}
Upvotes: 1