利用pdf2swf将PDF转换成SWF

将PDF转换成SWF可以使用SWFTools工具中的pdf2swf(http://www.swftools.org/),
CSDN快速免积分下载地址http://download.csdn.net/detail/itmyhome/7270665
一个简单的将PDF文档转成SWF的用法:
[plain] view plain copy 在CODE上查看代码片派生到我的代码片
C:\SWFTools\pdf2swf example.pdf -o example.swf -f -T 9

1、首先下载安装,一直默认下一步即可。
2、java代码
[java] view plain copy 在CODE上查看代码片派生到我的代码片
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;

public class TestPdf2Swf {
public static int convertPDF2SWF(String sourcePath, String destPath,
String fileName) throws IOException {
// 目标路径不存在则建立目标路径
File dest = new File(destPath);
if (!dest.exists())
dest.mkdirs();

    // 源文件不存在则返回  
    File source = new File(sourcePath);  
    if (!source.exists())  
        return 0;  

    // 调用pdf2swf命令进行转换  
    String command = "C:\\SWFTools\\pdf2swf.exe" + " " + sourcePath+ " -o "   
            + destPath + fileName + " -f -T 9";  
    System.out.println(command);  
    Process pro = Runtime.getRuntime().exec(command);  

    BufferedReader bufferedReader = new BufferedReader(  
            new InputStreamReader(pro.getInputStream()));  
    while (bufferedReader.readLine() != null);  
    try {  
        pro.waitFor();  
    } catch (InterruptedException e) {  
        e.printStackTrace();  
    }  
    return pro.exitValue();  
}  

/** 
 * @param args 
 */  
public static void main(String[] args) {  
    String sourcePath = "D:\\springFramework.pdf"; //源文件路径  
    String destPath = "D:\\";                      //目标路径  
    String fileName = "springFramework.swf";       //生成文件名  
    try {  
        TestPdf2Swf.convertPDF2SWF(sourcePath, destPath, fileName);  
    } catch (IOException e) {  
        e.printStackTrace();  
    }  
}  

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SWFTools is a collection of utilities for working with Adobe Flash files (SWF files). The tool collection includes programs for reading SWF files, combining them, and creating them from other content (like images, sound files, videos or sourcecode). SWFTools is released under the GPL. The current collection is comprised of the programs detailed below: • PDF2SWF A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas, graphics etc. inside your Flash Movie. It's based on the xpdf PDF parser from Derek B. Noonburg. • SWFCombine A multi-function tool for inserting SWFs into Wrapper SWFs, contatenating SWFs, stacking SWFs or for basic parameter manipulation (e.g. changing size). • SWFStrings Scans SWFs for text data. • SWFDump Prints out various informations about SWFs, like contained images/fonts/sounds, disassembly of contained code as well as cross-reference and bounding box data. • JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences. • PNG2SWF Like JPEG2SWF, only for PNGs. • GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs. • WAV2SWF Converts WAV audio files to SWFs, using the L.A.M.E. MP3 encoder library. • AVI2SWF Converts AVI animation files to SWF. It supports Flash MX H.263 compression. Some examples can be found at examples.html. (Notice: this tool is not included anymore in the latest version, as ffmpeg or mencoder do a better job nowadays) • Font2SWF Converts font files (TTF, Type1) to SWF. • SWFBBox Allows to read out, optimize and readjust SWF bounding boxes. • SWFC A tool for creating SWF files from simple script files. Includes support for both ActionScript 2.0 as well as ActionScript 3.0. • SWFExtract Allows to extract Movieclips, Sounds, Images etc. from SWF files. • AS3Compile A standalone ActionScript 3.0 compiler. Mostly compatible with Flex. SWFTools

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值