日期:2014-05-17  浏览次数:20377 次

百度文库、豆丁网效果
需求:实现类似百度文库效果,防止用户下载。
文库:http://wenku.baidu.com/view/82b7c51352d380eb62946ddb.html
豆丁:http://www.docin.com/p-68915279.html

网上找了很多资料,也研究了两天,但没有找到好的解决方案。还望csdn的大侠们帮帮忙!
先说一下我的方法吧
1、下载并安装Macromedia FlashPaper 2
2、将文件上传到服务器,包括的格式doc/xsl/ppt/vsd/txt/jpg...
3、在后台调用FlashPrinter.exe将上传的文件转换成SWF格式。即上传之后就立即转换。
代码如下:
C# code

public void ConvertToSWF(string oldFile, string swfFile)
{
            System.Diagnostics.Process pc = new System.Diagnostics.Process();
            pc.StartInfo.FileName = @"C:\Program Files\Macromedia\FlashPaper 2\FlashPrinter.exe";
            pc.StartInfo.Arguments = string.Format("{0} -o {1}", oldFile, swfFile);
            pc.StartInfo.CreateNoWindow = true;
            pc.StartInfo.UseShellExecute = false;
            pc.StartInfo.RedirectStandardInput = true;
            pc.StartInfo.RedirectStandardOutput = true;
            pc.StartInfo.RedirectStandardError = true;
            pc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            pc.Start();
            pc.WaitForExit();
            pc.Close();
            pc.Dispose();
}


4、查看文件的时候找到对应的SWF文件,在浏览器中直接浏览。

遇到的问题:
1、转换的时候会在服务器打开对应的软件窗口和FlashPaper转换器窗口。当然转换完成之后会关闭。
2、当转换PDF文件的时候,Adobe Reader窗口无法关闭。
3、在VS中任何格式都能转换正常,但是在IIS中只有txt、jpg等格式能转换,doc、xsl、ppt、pdf都不能转换(经调试,程序运行到pc.WaitForExit();处停止了)。

疑问:
1、考虑到并发访问,以上代码该如何调整。
2、个人觉得通过调用FlashPrinter.exe转换比较别扭。FlashPaper是否有提供类库,可以通过调用API直接转换。或是说有比使用FlashPaper更好的转换方式。


------解决方案--------------------
http://www.cnblogs.com/sobne/articles/1822479.html

在VS中任何格式都能转换正常,但是在IIS中只有txt、jpg等格式能转换,doc、xsl、ppt、pdf都不能转换

查看是否是权限的问题
------解决方案--------------------
参考这个
------解决方案--------------------
百度文库效果http://topic.csdn.net/u/20100705/11/be971d2c-e444-4360-a91a-7a490b6244e0.html?22087
------解决方案--------------------
参考
------解决方案--------------------
前排占个位。。。等成果。。。
------解决方案--------------------
探讨

前排占个位。。。等成果。。。

------解决方案--------------------
探讨

引用:

前排占个位。。。等成果。。。

++

------解决方案--------------------
探讨
引用:

引用:

前排占个位。。。等成果。。。

++

++

------解决方案--------------------
探讨
引用:
引用:

引用:

前排占个位。。。等成果。。。

++

++

++++

------解决方案--------------------
http://hi.baidu.com/yyq745201/blog/item/fc26d423d98aeae2d6cae268.html
------解决方案--------------------
http://www.conaito.com/office-powerpoint-excel-word-silverlight-converter-sdk.asp
------解决方案--------------------
期待有个好的解决方案。。。
------解决方案--------------------
都是牛人啊
------解决方案--------------------
探讨