• 实现类似百度文库效果,防止用户下载。


    先说一下我的方法吧
    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文件,在浏览器中直接浏览。

  • 相关阅读:
    【k8s】Volume-persistentVolumeReclaimPolicy
    【k8s】Volume-pv
    【k8s】Secret-生成环境变量
    【k8s】Volume-nfs
    【k8s】Volume-hostPath
    【k8s】Volume-emptyDir
    【k8s】Volume-downwardAPI
    【k8s】Volume-Secret
    【k8s】Volume-ConfigMap-file
    SQL SERVER 列转行
  • 原文地址:https://www.cnblogs.com/skynetfy/p/3490085.html
Copyright © 2020-2023  润新知