//pdf file to image convert(user to ghostscript and gswin32.exe)
string ghostScriptPath = "\"" + System.Windows.Forms.Application.StartupPath + "\\gswin32.exe \"";
string InputFileName = FileLocation.Replace("1.pdf", "watermark.pdf");
string OutputFileName = @"Z:\1";
PdfToImage(ghostScriptPath,InputFileName,OutputFileName );
public void PdfToImage(string ghostScriptPath,string PdfFile,string ImageFile)
{
String argu = "-dNOPAUSE -sDEVICE=jpeg -r400 -o" + ImageFile + "-%d.jpg " + PdfFile;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = ghostScriptPath;
proc.StartInfo.Arguments = argu;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
}
string ghostScriptPath = "\"" + System.Windows.Forms.Application.StartupPath + "\\gswin32.exe \"";
string InputFileName = FileLocation.Replace("1.pdf", "watermark.pdf");
string OutputFileName = @"Z:\1";
PdfToImage(ghostScriptPath,InputFileName,OutputFileName );
public void PdfToImage(string ghostScriptPath,string PdfFile,string ImageFile)
{
String argu = "-dNOPAUSE -sDEVICE=jpeg -r400 -o" + ImageFile + "-%d.jpg " + PdfFile;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = ghostScriptPath;
proc.StartInfo.Arguments = argu;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
}
No comments:
Post a Comment