将文档转换为flash预览

方法一:用FlexPaper实现

<head> 
        <title>FlexPaper</title>
    <script src="FP/js/flexpaper_flash.js" type="text/javascript"></script>
    </head>
<body>
    <div style="position:absolute;left:10px;top:10px;">
	        <a id="viewerPlaceHolder" style="width:680px;height:480px;display:block"></a>
	        
	        <script type="text/javascript">
	            var fp = new FlexPaperViewer(
						 'FP/FlexPaperViewer',
						 'viewerPlaceHolder', { config: {
						     SwfFile: '<%=getSWFFile() %>',
						     Scale: 0.75,
						     ZoomTransition: 'easeOut',
						     ZoomTime: 0.5,
						     ZoomInterval: 0.05,
						     FitPageOnLoad: false,
						     FitWidthOnLoad: false,
						     FullScreenAsMaxWindow: false,
						     ProgressiveLoading: true,
						     MinZoomSize: 0.2,
						     MaxZoomSize: 5,
						     SearchMatchAll: false,
						     InitViewMode: 'Portrait',

						     ViewModeToolsVisible: true,
						     ZoomToolsVisible: true,
						     NavToolsVisible: true,
						     CursorToolsVisible: false,
						     SearchToolsVisible: false,

						     localeChain: 'zh_CN'
						 }
						 });
	        </script>   
        </div>
</body>


 

protected string getSWFFile()
        {
            return "SwfFile/b.swf";
        }


 

        /// <summary>
        /// 将pdf文件转化成swf文件
        /// </summary>
        /// <param name="SWFToolsFullPath">SWFTools转换工具路径,具体到文件,如~/FP/SWFTools/pdf2swf.exe</param>
        /// <param name="SourceFilePath">pdf源文件路径,如~/SwfFile/</param>
        /// <param name="SourcefileName">要转换的pdf文件名,如b.pdf</param>
        /// <param name="SaveFilePath">转化成的swf文件保存路径,如~/SwfFile/</param>
        private static void ConvertCmd(string SWFToolsFullPath,string SourceFilePath, string SourcefileName,string SaveFilePath)
        {

            using (System.Diagnostics.Process p = new System.Diagnostics.Process())
            {
                string cmdStr = HttpContext.Current.Server.MapPath(SWFToolsFullPath);
                string sourcePath = HttpContext.Current.Server.MapPath(SourceFilePath);
                string savePath = HttpContext.Current.Server.MapPath(SaveFilePath);
                // @"""" 相当于一个双引号,之所以要加@"""" 就是为了防止要转换的过程中,文件夹名字带有空格,导致失败
                string sourcefullPath = @"""" + sourcePath + SourcefileName + @"""";
                string targetfullPath = @"""" + savePath + SourcefileName.Substring(0, SourcefileName.LastIndexOf(".")) + ".swf" + @"""";
                string argsStr = "  -t " + sourcefullPath + " -s flashversion=9 -o " + targetfullPath;
                //调用新进程 进行转换
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(cmdStr, argsStr);
                p.StartInfo = psi;
                p.Start();
                p.WaitForExit();
            }
        }


涉及到的资源另上传

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值