zoukankan      html  css  js  c++  java
  • world转pdf

            /// <summary>
            /// 将word文档转换成pdf
            /// </summary>
            /// <param name="paths">文档路径</param>
            /// <param name="outputPath">输出路径</param>
            public void AddDoc2pdf(string path, string outputFileName)
            {
                if (File.Exists(outputFileName))
                {
                    File.Delete(outputFileName);
                }
    
                //读取doc文档
                Document doc = new Document(path);
                //保存为PDF文件,此处的SaveFormat支持很多种格式,如图片,epub,rtf 等等
                doc.Save(outputFileName, Aspose.Words.SaveFormat.Pdf);
    
                System.IO.FileInfo file = new System.IO.FileInfo(outputFileName);
                Response.Clear();
                Response.Charset = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode("demo.pdf"));
                Response.AddHeader("Conten-Length", file.Length.ToString());
                Response.ContentType = "application/octet-stream";
                Response.WriteFile(file.FullName);
                Response.End();
    
            }

    需要引用:Aspose.Words

  • 相关阅读:
    NumPy线性代数
    NumPy矩阵库
    NumPy副本和视图
    NumPy字节交换
    NumPy排序、搜索和计数函数
    NumPy统计函数
    NumPy算数运算
    NumPy数学算数函数
    NumPy
    dp 动规 最佳加法表达式
  • 原文地址:https://www.cnblogs.com/shanshuiYiCheng/p/10169397.html
Copyright © 2011-2022 走看看