• 利用print2flashsetup.exe文档转swf


    通过使用Print2Flash您可以轻松的将您的文档转换成真正的Adobe Flash格式,最好的保证您的内容将实际可见,与其他格式相比,它并不存在查看工具的安装问题。

    Print2Flash中有一个Interop.Print2Flash3.dll

    准备工作:

    image

    1:先安装print2flashsetup.exe并启动windows服务。

    2:确定电脑安装了Microsoft Office 软件。

    3:创建项目并添加引用Interop.Print2Flash3.dll,如上图。

    4:还需要安装flash播放器。

    编写代码:

    以下代码在w732系统下验证成功。

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.IO;
    using System.Collections;
    
    namespace PdfToSwf
    {
        class Program
        {
            static void Main(string[] args)
            {
                ArrayList alist = new ArrayList();
                alist.Add("temp_pdf.pdf");
                alist.Add("temp_ppt.ppt");
                alist.Add("temp_pptx.pptx");
                alist.Add("temp_doc.doc");
                alist.Add("temp_docx.docx");
                alist.Add("temp_xls.xls");
                alist.Add("temp_xlsx.xlsx");
    
    
                for (int i = 0; i < alist.Count; i++)
                {
                    try
                    {
                        string pdfFilePath = alist[i].ToString();
                        FileInfo pdfFi = new FileInfo(pdfFilePath);
                        string filepath = pdfFi.FullName;
    
                        Console.WriteLine("正在转换" + pdfFilePath + "文件...");
                        Print2Falsh(filepath);
    
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("error:" + ex.Message);
                    }
                }
                Console.ReadKey();
            }
    
    
            public static string Print2Falsh(string SourceFileName)
            {
    
                string url = string.Empty;
                //在当前文件目录下生成一个同文件名的swf文件。
                string filename = Path.GetFileNameWithoutExtension(SourceFileName).ToLower();
                string imageDirectoryPath = Path.GetDirectoryName(SourceFileName);
                string OutputFileName = imageDirectoryPath + "/" + filename + ".swf";
    
                int interfaceOptions = (int)(Print2Flash3.INTERFACE_OPTION.INTDRAG | Print2Flash3.INTERFACE_OPTION.INTSELTEXT |
                    Print2Flash3.INTERFACE_OPTION.INTROTATE | Print2Flash3.INTERFACE_OPTION.INTNEWWIND | Print2Flash3.INTERFACE_OPTION.INTBACKBUTTON |
                    Print2Flash3.INTERFACE_OPTION.INTFORWARDBUTTON | Print2Flash3.INTERFACE_OPTION.INTFULLSCREEN |
                    Print2Flash3.INTERFACE_OPTION.INTPRINT | Print2Flash3.INTERFACE_OPTION.INTSEARCHBOX |
                    Print2Flash3.INTERFACE_OPTION.INTSEARCHBUT | Print2Flash3.INTERFACE_OPTION.INTFITWIDTH |
                    Print2Flash3.INTERFACE_OPTION.INTFITPAGE | Print2Flash3.INTERFACE_OPTION.INTZOOMSLIDER |
                    Print2Flash3.INTERFACE_OPTION.INTZOOMBOX | Print2Flash3.INTERFACE_OPTION.INTPREVPAGE |
                    Print2Flash3.INTERFACE_OPTION.INTGOTOPAGE | Print2Flash3.INTERFACE_OPTION.INTNEXTPAGE);
    
                Print2Flash3.Server2 p2fServer = new Print2Flash3.Server2();
                p2fServer.DefaultProfile.InterfaceOptions = interfaceOptions;
                p2fServer.DefaultProfile.ProtectionOptions = (int)Print2Flash3.PROTECTION_OPTION.PROTENAPI;
                p2fServer.ConvertFile(SourceFileName, OutputFileName, null, null, null);
    
                url = OutputFileName;
    
                return url;
            }
        }
    }
     

    获取源码:

    http://download.csdn.net/detail/luomingui/9170879

  • 相关阅读:
    并行 并发 概念
    为什么C++编译器不能支持对模板的分离式编译_刘未鹏
    并发编程的15 条建议
    VS2005 C++ str.Format 编译错误
    PPT 去除排练计时
    VS2005中 depends.exe 在哪里
    《A wavelet tour of signal processing》前言摘录
    Windows Forms 2.0 Programming 读书笔记Hello, Windows Forms
    VS2005 宽字符 unicode字符集和多字节字符集
    Windows Forms 2.0 Programming 读书笔记Hello, Windows Forms(2)
  • 原文地址:https://www.cnblogs.com/luomingui/p/4868667.html
Copyright © 2020-2023  润新知