C# pdf 转换成 image
软件下载及注册机:https://files.cnblogs.com/kaixing/PDF2IMG.rar
要正常运行程序必须下载
代码如下
public void Pdf2Img(string path, string pdfName)
{
//软件地址
string cmdStr = AppDomain.CurrentDomain.BaseDirectory + "PDF2Image\\pdf2img.exe";
string SourcePath = @"""" + path + @"""";
string TargetPath = @"""" + AppDomain.CurrentDomain.BaseDirectory + "Images\\" + pdfName.Substring(0, pdfName.LastIndexOf(".")) + ".gif" + @"""";
//命令
string argsStr = " -r 25 -f 1 -l 1 -i " + SourcePath + " -o " + TargetPath;
//调用新进程 进行转换
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo(cmdStr, argsStr);
p.StartInfo = psi;
p.Start();
p.WaitForExit();
File.Delete(path);
}