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

引用
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

你可能感兴趣的:(java,c,Flex,Office,大众软件)