以前用的flashpapger但是很 遗憾不支持64位机子。
改用print2Flash。
java代码如下:
import java.io.*;
import com.jacob.activeX.*;
import com.jacob.com.*;
public class TestPrint2Flash {
public static void main(String[] args) throws java.io.IOException {
getswf("D:\\aa.doc");
}
public static void getswf(String args) throws IOException {
if (args.length() > 0) {
try {
ComThread.InitSTA();
// Create Server object
ActiveXComponent p2f = new ActiveXComponent(
"Print2Flash3.Server");
// Setup interface and protection options
ActiveXComponent defProfile = new ActiveXComponent(p2f
.getProperty("DefaultProfile").toDispatch());
defProfile.setProperty("InterfaceOptions", P2FConst.INTDRAG
| P2FConst.INTSELTEXT | P2FConst.INTZOOMSLIDER
| P2FConst.INTZOOMBOX | P2FConst.INTFITWIDTH
| P2FConst.INTFITPAGE | P2FConst.INTPREVPAGE
| P2FConst.INTGOTOPAGE | P2FConst.INTNEXTPAGE
| P2FConst.INTSEARCHBOX | P2FConst.INTSEARCHBUT
| P2FConst.INTPRINT | P2FConst.INTNEWWIND
| P2FConst.INTFULLSCREEN | P2FConst.INTFULLSCREENAUTO);
// defProfile.setProperty("ProtectionOptions",
// P2FConst.PROTDISPRINT | P2FConst.PROTENAPI);
// Convert document
System.out.println(args);
//p2f.invoke("ConvertFile", new String(args));
System.out.println("swf转换成功...");
} catch (Exception e) {
System.out.println("swf转换失败: " + e.toString());
} finally {
ComThread.Release();
}
} else
System.out.println("转swf出错。。。。");
}
}
public class P2FConst
{
// APPLICATIONTYPE enumeration constants
public static final int MSEXCEL = 0x00000001;
public static final int MSWORD = 0x00000002;
public static final int MSPOWERPOINT = 0x00000004;
public static final int ACROBAT = 0x00000008;
// IMAGEFORMAT enumeration constants
public static final int JPEG = 1;
public static final int PNG = 2;
// IMGBEHAVIOR enumeration constants
public static final int STRETCH = 1;
public static final int TILE = 2;
// INTERFACE_OPTION enumeration constants
public static final int INTLOGO = 0x00000001; //系统logo
public static final int INTDRAG = 0x00000002; //拖动按钮
public static final int INTSELTEXT = 0x00000004; //选择“文本”按钮
public static final int INTZOOMSLIDER = 0x00000008; //缩放滑块
public static final int INTZOOMBOX = 0x00000010;//缩放框
public static final int INTFITWIDTH = 0x00000020;//“适合宽度”按钮
public static final int INTFITPAGE = 0x00000040;//适合页面按钮
public static final int INTPREVPAGE = 0x00000080;//上一页按钮
public static final int INTGOTOPAGE = 0x00000100;//转到页框
public static final int INTNEXTPAGE = 0x00000200;//“下一页”按钮
public static final int INTSEARCHBOX = 0x00000400;//搜索框
public static final int INTSEARCHBUT = 0x00000800;//“搜索”按钮
public static final int INTROTATE = 0x00001000;//旋转按钮
public static final int INTPRINT = 0x00002000;//“打印”按钮
public static final int INTNEWWIND = 0x00004000;//打开新窗口“按钮
public static final int INTHELP = 0x00008000;//帮助按钮
public static final int INTBACKBUTTON = 0x00030000;//总是显示后退按钮
public static final int INTBACKBUTTONAUTO = 0x00010000;//显示后退按钮只有内部链接在文档中存在
public static final int INTFORWARDBUTTON = 0x000C0000;//总是显示“前进”按钮
public static final int INTFORWARDBUTTONAUTO = 0x00040000;//正向显示按钮只有内部链接在文档中存在
public static final int INTFULLSCREEN = 0x00300000;//总是显示“全屏”按钮
public static final int INTFULLSCREENAUTO = 0x00100000;//如果它可以检测Flash播放器不支持或允许使用全屏幕模式,隐藏的全屏按钮。否则,显示“全屏”按钮。
// METADATAPORMAT enumeration constants
public static final int XML = 1;
public static final int TEXT = 2;
// OUTPUTFORMAT enumeration constants
public static final int SINGLEFILE = 1;
public static final int SINGLEFILEPERPAGE = 2;
public static final int EXTVIEWER = 4;
// PAPER_ORIENTATION enumeration constants
public static final int ORIENT_PORTRAIT = 1;
public static final int ORIENT_LANDSCAPE = 2;
// PROTECTION_OPTION enumeration constants
public static final int PROTDISPRINT = 0x00000001;//禁用文档打印
public static final int PROTDISTEXTCOPY = 0x00000002;//禁止复制文本的文档由用户
public static final int PROTENAPI = 0x00000004;//启用Print2Flash文件API支持(从Flash使用Print2Flash文件API的是只有部分禁用)
// ThreeStateFlag enumeration constants
public static final int TSF_NO = 0;
public static final int TSF_YES = 1;
public static final int TSF_AUTO = 2;
// TOOLBARIMAGE enumeration constants
public static final int IMGLOGO = 1;
public static final int IMGDRAG = 2;
public static final int IMGSELTEXT = 3;
public static final int IMGZOOMRULER = 4;
public static final int IMGZOOMFOCUSNADLE = 5;
public static final int IMGZOOMNADLE = 6;
public static final int IMGFITWIDTH = 7;
public static final int IMGFITPAGE = 8;
public static final int IMGPREVPAGE = 9;
public static final int IMGNEXTPAGE = 10;
public static final int IMGSEARCHBUT = 11;
public static final int IMGROTATE = 12;
public static final int IMGPRINT = 13;
public static final int IMGNEWWIND = 14;
public static final int IMGHELP = 15;
public static final int IMGMORE = 16;
public static final int IMGTOOLBARBGR = 17;
public static final int IMGBACK = 18;
public static final int IMGFORWARD = 19;
public static final int IMGFULLSCREEN = 20;
public static final int IMGEXITFULLSCREEN = 21;
// TEMPLATETYPE enumeration constants
public static final int TEMPLATE_CUSTOM = 1;
public static final int TEMPLATE_ACTIONSCRIPT2 = 2;
public static final int TEMPLATE_ACTIONSCRIPT3 = 3;
// WATERMARKANCHOR enumeration constants
public static final int CENTER = 0;
public static final int LEFTCENTER = 1;
public static final int RIGHTCENTER = 2;
public static final int TOPCENTER = 16;
public static final int BOTTOMCENTER = 32;
public static final int LEFTTOP = 17;
public static final int RIGHTTOP = 18;
public static final int LEFTBOTTOM = 33;
public static final int RIGHTBOTTOM = 34;
// COMPRESSION_METHOD enumeration constants
public static final int COMPRESSION_METHOD_ZLIB = 0;
public static final int COMPRESSION_METHOD_LZMA = 1;
}
例子完整路径下载: http://download.csdn.net/detail/hateson/5844699