一切福田,不離方寸,從心而覓,感無不通。

asp.net 在线阅读pdf

FlashPaper是一个虚拟打印机,可将word文件转化成swf格式文件(.doc .xls .txt .pdf等文件都可以正常生成SWF格式)。最近简单学习了在ASP.NET页面中调用FlashPaper将word文件转化成swf格式文件的方法。 (1)安装FlashPape:下载FlashPape压缩包,解压缩后,运行初始化目录中的初始化.bat,然后安装FlashPaperDriverInstall2.exe,即FlashPaper打印机。特别注意,在有的机器上要更改Macromedia FlashPape的端口,应为FlashPape2PrinterPort,如果是LPT1这个端口,当然打印不出来了。 (2)为页面中的按钮编写事件处理代码:

示例代码3:

{ string fppath = System.Configuration.ConfigurationManager.AppSettings["Flashpaper"]; string outpath = filepath.Substring(0, filepath.LastIndexOf('.')) + ".swf"; string param = fppath + " " + filepath + " -o " + outpath; Process p = new Process(); p.StartInfo.FileName = "C:\\WINDOWS\\system32\\cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; //p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; try { p.Start(); string strOutput = null; p.StandardInput.WriteLine(param); p.StandardInput.WriteLine("exit"); strOutput = p.StandardOutput.ReadToEnd(); Console.WriteLine(strOutput); p.WaitForExit(); p.Close(); } catch (Exception ex) { throw ex; } }

龙生   13 May 2013
View Details