使用C#,我需要将PDF文件的每一页转换为单独的图像并显示这些图像。
不使用第三方DLL,是否有可能实现这一点?
不使用第三方DLL,是否有可能实现这一点?
string cl2 = @"-dSAFER -dNoVerifyXref -dQUIET -dNOPROMPT"
+ " -dBATCH -dNOPAUSE -sDEVICE=jpeg -r72 -dFirstPage=1 "
+ "-dLastPage=1 -dUseCropBox -sOutputFile=" + SourceFile
+ " " + TargetFile;
try
{
Made4Print.GhostScript gs =
new Made4Print.GhostScript(@"[path-to-gs-installation]");
gs.CallGSDll(cl2.Split(' '));
}
catch
{
//exception handler
}
这将第一页保存为72 dpi的JPEG格式
我已经完成了这个Ghost脚本,用于将PDF转换为图像。希望这个对你有所帮助。
"-dNOPAUSE -dBATCH -dSAFER -sDEVICE=tifflzw -dTextAlphaBits=1 -dPDFFitPage -sOutputFile="C:\Users\cis\Desktop\asp634667352520620000.tif" "C:\Users\cis\Desktop\asp.pdf""