(1)安装FlashPape:下载FlashPape压缩包,解压缩后,运行初始化目录中的初始化.bat,然后安装FlashPaperDriverInstall2.exe,即FlashPaper打印机。特别注意,在有的机器上要更改Macromedia
FlashPape的端口,应为FlashPape2PrinterPort,如果是LPT1这个端口,当然打印不出来了。
(2)为页面中的按钮编写事件处理代码:
程序代码
Process
process = new Process(); //创建进程对象
//try
//{
ProcessStartInfo startInfo = new ProcessStartInfo();
string paperroot = @"C:\Program Files\Macromedia\FlashPaper
2\FlashPrinter.exe";
string docFile =
Server.MapPath("1.doc");
string swfFile =
Server.MapPath("1.swf");
startInfo.FileName = paperroot;
startInfo.Arguments = docFile + " -o " + swfFile;
startInfo.UseShellExecute = false; //不使用系统外壳程序启动
startInfo.RedirectStandardInput = false; //不重定向输入
startInfo.RedirectStandardOutput = false; //重定向输出
startInfo.CreateNoWindow = true; //不创建窗口
process.StartInfo
= startInfo;
process.Start();
Response.Write("已经提交生成。
");
Response.Write(paperroot+"
"+docFile + " = " + swfFile);
//}
//catch (Exception ex)
//{
//
Response.Write(ex.Message);
//}
//finally
//{
if (process != null)
process.Close();
// Response.Write("
finally");
//}
注意:有人说,FlashPrinter.exe所在的目录名称中不能有空格,否则转换失败。其实我上面的不不带空格了它同样转换成功了。