加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

类似百度文档库的flash播放器FlexPaper

发布时间:2020-12-15 06:34:14 所属栏目:百科 来源:网络整理
导读:你可以从http://flexpaper.googlecode.com/svn/trunk上下载flexpaer播放器,还有源码 ,用要SVN检出, 1 :下载openoffice,安装到本机,然后能过命令行打开服务 ? cd C:Program FilesOpenOffice.org 3program soffice -headless -accept="socket,host=127
你可以从http://flexpaper.googlecode.com/svn/trunk上下载flexpaer播放器,还有源码 ,用要SVN检出, 1 :下载openoffice,安装到本机,然后能过命令行打开服务 ? cd C:Program FilesOpenOffice.org 3program soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard ? 在程序中你可以能过代码将word,txt,...数据源转化成Pdf格式的, 这是测试代码: public static void main(String[] args) { File inputFile = new File("D:新建文件夹 (2)河南分公司“创先争优”活动简报? 第一期.doc"); File outputFile = new File("D:新建文件夹 (2)河南分公司“创先争优”活动简报? 第一期.pdf"); // connect to an OpenOffice.org instance running on port 8100 OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); try { connection.connect(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } // convert DocumentConverter converter = new OpenOfficeDocumentConverter(connection); converter.convert(inputFile,outputFile); // close the connection connection.disconnect(); } 2:安装swftoos到本机,可以能过代码将pdf格式 的文件转化成swf public static int ConvertPdfToSwf(String fileName,String destPath){?? ??????? String destName = "",fileExt = "";?? ??????? StringBuffer command = new StringBuffer();?? ??????? fileExt = fileName.split(".")[fileName.split(".").length-1].toLowerCase(); ??????? try{?? ??????????? File file = new File(fileName);?? ??????????? if(!file.exists()){//判断源文件是否存在?? ??????????????? return 1;?? ??????????? }else if(!fileExt.equals("pdf")){//判断文件是否是pdf格式的文件?? ??????????????? return 2;?? ??????????? }?? ??????????? else{?? ??????????????? String swftoolsPath = "C:Program FilesSWFTools";//获取pdf转swf工具的路径?? ??????????????? if(!swftoolsPath.substring(swftoolsPath.length()-1,swftoolsPath.length()).equals("")){?? ??????????????????? swftoolsPath = swftoolsPath+"";??? //在目录后加 ""?? ??????????????? }?? ??????????????? if(!destPath.substring(destPath.length()-1,destPath.length()).equals("")){?? ??????????????????? destPath = destPath+"";??? //在目录后加 ""?? ??????????????? }?? ??????????????? File destFile = new File(destPath);?? ??????????????? if(!destFile.exists()){//目标文件路径如果不存在,则创建目录?? ??????????????????? destFile.mkdirs();?? ??????????????? }?? ??????????????? destName = file.getName().substring(0,file.getName().length()-4)+".swf";//目标文件名称?? ??????????????? command.append(swftoolsPath).append("pdf2swf.exe ").append(fileName).append(" -o ").append(destPath).append(destName);?? ??????????????? Process pro = Runtime.getRuntime().exec(command.toString());?? ??????????????? BufferedReader buffer = new BufferedReader(new InputStreamReader(pro.getInputStream()));?? ??????????????? while(buffer.readLine()!=null);?? ??????????????? return pro.exitValue();?? ??????????? }?? ??????? }catch (Exception e){?? ??????????? e.printStackTrace();?? ??????????? return 3;?? ??????? }?? 3:最后再把Exmple/FlexPaperViewer.html里面的SwfFile : escape("20100826124510.swf?v1.4.0rc2-refresh2"),文件名改成你要播放的那个swf,就可以看到效果了。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读