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

doc转swf

发布时间:2020-12-15 06:21:19 所属栏目:百科 来源:网络整理
导读:将doc转换成swf,然后显示在html页面上。 Java代码?? package ?org.forever.util;?? ?? import ?java.io.File;?? import ?java.util.HashMap;?? import ?java.util.Map;?? import ?org.apache.log4j.Logger;?? public ? class ?FlashPaperUtil?{?? ???? priv

将doc转换成swf,然后显示在html页面上。

Java代码??

收藏代码

  1. package?org.forever.util;??
  2. ??
  3. import?java.io.File;??
  4. import?java.util.HashMap;??
  5. import?java.util.Map;??
  6. import?org.apache.log4j.Logger;??
  7. public?class?FlashPaperUtil?{??
  8. ????private?static?final?String?UNINSTALL_BAT?=?"uninstall.bat";??
  9. final?String?INSTALL_BAT?=?"install.bat";??
  10. static?Logger?log?=?Logger.getLogger(FlashPaperUtil.class);??
  11. final?String?CMD_C_START?=?"cmd?/c?start?";??
  12. final?String?FLASH_PRINTER_EXE?=?"FlashPrinter.exe";??
  13. final?String?FLASH_PAPER2_2?=?"FlashPaper2.2";??
  14. final?String?SPACE?=?"?";??
  15. static?String?flashPaperDir;??
  16. static?String?flashPrinterPath;??
  17. static?String?installPath;??
  18. static?String?unInstallPath;??
  19. static?Runtime?runtime?=?Runtime.getRuntime();??
  20. ??????
  21. static?Map<String,?String>?fileMap?=?new?HashMap<String,?String>();??
  22. static?FlashPaperUtil?instance;??
  23. private?FlashPaperUtil(){??
  24. ????????flashPaperDir?=???
  25. ????????????FlashPaperUtil.class.getClassLoader().getResource(??
  26. ????????????????????FLASH_PAPER2_2).getFile();??
  27. ????????for?(File?file?:?new?File(flashPaperDir).listFiles())?{??
  28. ????????????fileMap.put(file.getName(),?file.getAbsolutePath());??
  29. ????????}??
  30. ????????flashPrinterPath?=?fileMap.get(FLASH_PRINTER_EXE);??
  31. ????????installPath?=?fileMap.get(INSTALL_BAT);??
  32. ????????unInstallPath?=?fileMap.get(UNINSTALL_BAT);??
  33. ????}??
  34. static?FlashPaperUtil?getInstance(){??
  35. if(null?==?instance){??
  36. ????????????synchronized?(FlashPaperUtil.class)?{??
  37. ????????????????instance?=?new?FlashPaperUtil();??
  38. ????????????}??
  39. return?instance;??
  40. void?docToSwf(String?docPath,?String?outPath)??
  41. throws?Exception?{??
  42. ????????String?command?=?flashPrinterPath?+?SPACE?+?docPath?+?SPACE?+?"-o"??
  43. ????????????????+?SPACE?+?outPath;??
  44. ????????Process?process?=?runtime.exec(command);??
  45. ????????process.waitFor();??
  46. ????????process.destroy();??
  47. ????????File?outFile?=?new?File(outPath);??
  48. if(outFile.exists()){??
  49. ????????????log.info("docToSwf?success.........");??
  50. void?install()? ????????String?cmd?=?CMD_C_START?+?installPath;??
  51. ????????Process?process?=?runtime.exec(cmd,null,new?File(flashPaperDir));??
  52. ????????log.info("install?success..........");??
  53. void?uninstall()? ????????String?cmd?=?CMD_C_START?+?unInstallPath;??
  54. ????????log.info("uninstall?success..........");??
  55. void?main(String[]?args)? ????????FlashPaperUtil.getInstance();??
  56. }??

?

?该工具不适用于64



?如果要用64的,使用print2Flash,掉用命令:

p2Server.exe F:abc.doc F:abc.swf /createlogfile:on /logfilename:F:doc2swf.log

或者p2Server.exe F:abc.doc F:abc.swf

(编辑:李大同)

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

    推荐文章
      热点阅读