zoukankan      html  css  js  c++  java
  • 实现类似百度文库效果,防止用户下载。

    先说一下我的方法吧
    1、下载并安装Macromedia FlashPaper 2
    2、将文件上传到服务器,包括的格式doc/xsl/ppt/vsd/txt/jpg...
    3、在后台调用FlashPrinter.exe将上传的文件转换成SWF格式。即上传之后就立即转换。
    代码如下:

    C# code?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    public void ConvertToSWF(string oldFile, string swfFile)
    {
                System.Diagnostics.Process pc = new System.Diagnostics.Process();
                pc.StartInfo.FileName = @"C:Program FilesMacromediaFlashPaper 2FlashPrinter.exe";
                pc.StartInfo.Arguments = string.Format("{0} -o {1}", oldFile, swfFile);
                pc.StartInfo.CreateNoWindow = true;
                pc.StartInfo.UseShellExecute = false;
                pc.StartInfo.RedirectStandardInput = true;
                pc.StartInfo.RedirectStandardOutput = true;
                pc.StartInfo.RedirectStandardError = true;
                pc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                pc.Start();
                pc.WaitForExit();
                pc.Close();
                pc.Dispose();
    }


    4、查看文件的时候找到对应的SWF文件,在浏览器中直接浏览。

  • 相关阅读:
    Java类型转换.
    搭建jenkins集群node结点
    java Lambda
    @Autowired使用说明
    Disruptor底层实现讲解与RingBuffer数据结构讲解
    Disruptor并发框架简介
    并发编程中的读写锁分离锁的使用
    并发编程过程中的重入锁
    互联网进行限流策略的Semaphore信号量使用
    并发编程中Future和Callable使用
  • 原文地址:https://www.cnblogs.com/skynetfy/p/3490085.html
Copyright © 2011-2022 走看看