百度文库

实现的效果如下:

步骤:
1,利用FileUpload控件做文件上传
2,转换:安装FlashPaper2.2,
在程序中调用cmd命令完成转换:
FlashPrinter.exe “test.doc” -o “test4.swf”
注:iis及应用程序池需开权限以执行FlashPrinter
如下:

try
{
Process p = new Process();
p.StartInfo.FileName = "cmd";
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;
p.Start();
string strOutput = null;
string outputPath = Server.MapPath("~//test5.swf");
string s = @"FlashPrinter.exe "   + "\"" + FilePath + "\" -o \"" + outputPath + "\"";
p.StandardInput.WriteLine(s);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
lblMessage.Text = "success";
embed1.Attributes.Add("src", outputPath);
}
catch (Exception ex)
{
lblMessage.Text = ex.ToString();
}
注:执行完之后可关掉进程
/// <summary>
 /// 根据进程名称来关闭进程
 /// </summary>
 /// <param name="processName"></param>
 private static void KillPrecess(string processName)
 {
 foreach (Process p in Process.GetProcesses())
 {
 if (p.ProcessName == processName)
 {
 p.Kill();
 }
 }
 }

3,在线播放:若文档较小,一般的flash播放器即可。若文件很大,一次加载所有再显示文件的播放器显然会拖慢速度,这时需要了解的是一个开源的flexpaper播 放器,它可以播放一帧一页的flash;要像百度文库、豆丁一样修改flexpaper,让它支持一次仅读取指定页数的flash;如果文档安全级别较 高,不允许下载查看,则需要给flexpaper加上加密解密算法;如果需要登录用户才能查看,则要让flexpaper有登录UI。

原文地址:http://enjoyasp.net/?p=1056

转载于:https://www.cnblogs.com/vmyspace/archive/2012/07/20/2601076.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值