print2flash使用

来源:互联网 发布:淘宝严禁出售黄赌毒 编辑:程序博客网 时间:2024/06/06 19:12

使用print2flah转换文档为flash制作在线预览。

1、首先引用Interop.Print2Flash3.dll。

2、IServer server=new Server();//声明并初始化转换服务器类

     server.SetP2FPrinterAsDefault();//设置问默认的虚拟打印机

     if(server.Skins["custom_chainan"]==null)

{

server.Skins.Add("custom_chainan");

}

ISkin skin=(ISkin) server.Skins["custom_chainan"];

skin.SetToolbarImage(TOOLBAR_IMAGE,IMGLOGO,@"C:\siteIcon.png");//必须为png格式的图片全名;更改转出来的logo图片

skin.HelpButtonURL="http://blog.csdn.net/chainan1988";

skin.LogoURL="http://blog.csdn.net/chainan1988";

skin.ApplyChanges();

Print2Flash3.INTERFACE_OPTION interfaceOption=(Print2Flash3.INTERFACE_OPTION)server.DefaultProfile.InterfaceOptions;

server.DefaultProfile.InterfaceOptions=(int) (interfaceOption&~Print2Flash3.INTERFACE_OPTION.INTLOGO);//去掉logo图片(可选),这样的话上面设置logo图片就看不到效果


转换单个文档

server.ConvertFile(@"test.txt",@"test.txt.swf");//转换单个文档,第一个参数是要转换的文档名,第二个是转换后的文档名

转换批量文档

IBatchProcessingOptions batchOptions = new BatchProcessingOptions();

                batchOptions.ActivityTimeout =1000;

                batchOptions.AfterPrintingTimeout =1000;
                batchOptions.BeforePrintingTimeout =
1000;
                batchOptions.PrintingTimeout =
1000;
                batchOptions.KillProcessIfTimeout = ThreeStateFlag.TSF_AUTO;
                batchOptions.PressPrintButton = ThreeStateFlag.TSF_AUTO;
                batchOptions.KillProcessIfTimeout = ThreeStateFlag.TSF_AUTO;
                batchOptions.KeepAutomationAppRef = APPLICATIONTYPE.ALL;
                batchOptions.KillAllAutomationProcesses = ThreeStateFlag.TSF_AUTO;


                batchOptions.CreateLogFile = true;
                batchOptions.LogFileName = "log.log";
                batchOptions.LoggingLevel =
1;//设置日志级别

                batchOptions.ApplyChanges();

server.ConvertDir(@"c:\input",null,@"c:\output", Type.Missing,Type.Missing, Type.Missing, Type.Missing);


获得转换结果错误数量:server.ErrorCount

获得转换文档数:server.FilesConverted

print2flash 64位安装程序



原创粉丝点击