doc,ppt,pdf,swf之间互转工具介绍

工具一:

flex swftools可将图片、pdf转化成swf

利用java批量转化方法:

1.安装java jdk并设置java环境变量
2.安装flex pdf2swf并设置环境变量(path=安装目录)
3.将ExecuteCmd.java编译成ExecuteCmd.class(编译方法可参照其他文章)拷贝到d盘下

  ExecuteCmd.java代码:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

public class ExecuteCmd {
 
 public static void main(String[] args) throws Exception {
  turnPdfToSwf(args[0], args[1], args[2]);
  //turnPdfToSwf("E:\\test","E:\\test","C:\\SWFTools");
 }
 
 
 public static List<String> getFileName(File file,List<String> fileDirs){
   //File []
  File[] files = file.listFiles();
  for (int i = 0; i < files.length; i++) {
   //chird dir
   if(files[i].isDirectory()){
    System.out.println("child dir is:"+ files[i].getAbsolutePath());
    fileDirs.add(files[i].getAbsolutePath());
    getFileName(files[i],fileDirs);
   }
  }
  return fileDirs;
 }

 
 public static void turnPdfToSwf(String pdfAltPath,String swfAltPath,String rfxviewSwfPath){
  File file = new File(pdfAltPath);
  List<String> fileDirs = new ArrayList<String>();
  List<String> pdfDirs = getFileName(file,fileDirs);
  for (String pdfDir : pdfDirs) {
   turnInDirPdfToSwf(pdfDir,pdfDir.replace(pdfAltPath,swfAltPath), rfxviewSwfPath);
  }
 }
 
 public static void turnInDirPdfToSwf(String pdfPath,String swfPath,String rfxviewSwfPath){
  //get pdf files
  File pdfDirectory = new File(pdfPath);
  File[] pdfFiles = pdfDirectory.listFiles();
  //create swf file directory
  File swfDirectory = new File(swfPath);
  if(!swfDirectory.exists()){
   swfDirectory.mkdirs();
  }
  //log info file
  File logFile = new File("d:\\turnPdfToSwf.txt");
  if(!logFile.exists()){
   try {
    logFile.createNewFile();
   } catch (IOException e) {
    e.printStackTrace();
   }
  }
  
  PrintWriter pw = null;
  if(pdfFiles != null){
   for (File file : pdfFiles) {
    if(file.getName().endsWith(".pdf")){
     String fileName = file.getName().substring(0,file.getName().indexOf(".pdf"));
     String logStr = "";
     //turn file
     try {
      Runtime.getRuntime().exec("cmd /c pdf2swf -o " + pdfPath + "\\" + fileName + ".swf -z -B " + rfxviewSwfPath +"\\rfxview.swf -s flashversion=7 -t " + swfPath + "\\" + fileName + ".pdf");
      logStr = "success filename:" + fileName;
     } catch (IOException e) {
      e.printStackTrace();
      logStr = "fault filename:" + fileName;
     }
     //log
     try {
      pw = new PrintWriter(new FileOutputStream(logFile,true));
      pw.print(logStr + "\n");
      pw.close();
     } catch (IOException ex) {
      ex.printStackTrace();
     }
    }
   }
  }
 } 
}
4.开始->运行->cmd回车
  在d盘根目录下执行: (pdfPath:存放pdf的文件夹路径;swfPath:生成swf的存放文件夹路径;pdf2swfPath:pdf2swf工具安装路径)
  java ExecuteCmd pdfPath swfPath pdf2swfPath
  例:
  java ExecuteCmd E:\test E:\test C:\SWFTools
5.日志为d:turnPdfToSwf.txt:

 

工具二:

FlashPaper:将office文件转为swf

 

工具三:

Adobe Acrobat Professional:

可将ppt、mht、doc等文件批量转换成pdf

 

其他工具:

SaveAsPDFandXPS、dopdf、printconductor、batchdocprint

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值