首页 技术 正文
技术 2022年11月12日
0 收藏 496 点赞 4,305 浏览 1999 个字
一。Process类调用SWFTools工具将PDF文档转为swf文档1  string cmdStr = "D:\\SWFTools\\pdf2swf.exe";
string PDFPath = HttpContext.Current.Server.MapPath("PDFFile/liuzeliang.pdf");
string SWFPath = HttpContext.Current.Server.MapPath("SWFFile");
string args = " -o "+"\""+SWFPath+"\\liuzeliang.swf"+"\""+ " -s flashversion=9 " + "\""+ PDFPath+"\"";
using (Process p = new Process())
{
try
{
p.StartInfo.FileName = cmdStr;
p.StartInfo.Arguments = args;
p.StartInfo.UseShellExecute = false; //不使用系统外壳程序启动
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.CreateNoWindow = false;
p.Start();
//p.StandardInput.WriteLine(args);
p.WaitForExit();
if (p != null)
{
p.Close();
}
}
catch (Exception)
{
throw;
}
}
遇到的问题大概如下(swftools-0.9.0  Windows版本 官网下载地址:http://www.swftools.org/download.html):
1.调用pdf2swf.exe将pdf转swf失败。
      原因:swf文件存放路径含义空格(红色部分D:\Users\zeliang.liu\Documents\Visual Studio 2015\Projects\FlexPaperTest\FlexPaperTest\SWFFile)
解决方法:给整个路径用双引号括起来。(红色部分:string args = " -o "+"\""+SWFPath+"\\liuzeliang.swf"+"\""+ " -s flashversion=9 " + "\""+ PDFPath+"\"";)
2.转换成功后调用FlexPaper无法显示。
      原因:swf文件版本问题。
      解决方法:在传入process的参数里加入 -s flashversion=9 注意=前后不要有空格。(其实我刚开始用的-T并不能成功显示)

二。利用flexpaper插件显示swf文件

  
1.先下载好flexpaper的.rar包,然后将包中的js复制到项目中在引用下面俩个js到页面(我的flexpaper是1.4.5版本的)2.将文件夹中的FlexPaperViewer.swf放到项目中去
<script src="scripts/flexpaper/jquery.js"></script>
<script src="scripts/flexpaper/flexpaper_flash.js"></script>

 1 <a id="viewerPlaceHolder" style="width:660px;height:480px;display:block"></a>
<script type="text/javascript">
var swfFile = "SWFFile/liuzeliang.swf";
var fp = new FlexPaperViewer(
///FlexPaper组件的SWF框架路径
'scripts/flexpaper/FlexPaperViewer',
'viewerPlaceHolder',
{
config:
{
///需要显示的.swf
SwfFile: escape(swfFile),
Scale: 0.6,
ZoomTransition: 'easeOut',
ZoomTime: 0.5,
ZoomInterval: 0.2,
FitPageOnLoad: false,
FitWidthOnLoad: false,
PrintEnabled: true,
FullScreenAsMaxWindow: false,
ProgressiveLoading: false,
MinZoomSize: 0.2,
MaxZoomSize: ,
SearchMatchAll: false,
InitViewMode: 'Portrait',
ViewModeToolsVisible: true,
ZoomToolsVisible: true,
NavToolsVisible: true,
CursorToolsVisible: true,
SearchToolsVisible: true,
localeChain: 'en_US'
}
}); </script>

       


    					
上一篇: Promise库
下一篇: java连接jdbc
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,499
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,913
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,746
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,503
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,142
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,305