狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

C#使用aspose將Office文檔轉換為PDF代碼(去除水印)

admin
2020年4月3日 22:4 本文熱度 4371

1、去除水印代碼

public const string Key =

            "PExpY2Vuc2U+DQogIDxEYXRhPg0KICAgIDxMaWNlbnNlZFRvPkFzcG9zZSBTY290bGFuZCB" +

            "UZWFtPC9MaWNlbnNlZFRvPg0KICAgIDxFbWFpbFRvPmJpbGx5Lmx1bmRpZUBhc3Bvc2UuY2" +

            "9tPC9FbWFpbFRvPg0KICAgIDxMaWNlbnNlVHlwZT5EZXZlbG9wZXIgT0VNPC9MaWNlbnNlV" +

            "HlwZT4NCiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1p" +

            "dGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+DQogICAgPE9yZGVySUQ+MTQ" +

            "wNDA4MDUyMzI0PC9PcmRlcklEPg0KICAgIDxVc2VySUQ+OTQyMzY8L1VzZXJJRD4NCiAgIC" +

            "A8T0VNPlRoaXMgaXMgYSByZWRpc3RyaWJ1dGFibGUgbGljZW5zZTwvT0VNPg0KICAgIDxQc" +

            "m9kdWN0cz4NCiAgICAgIDxQcm9kdWN0PkFzcG9zZS5Ub3RhbCBmb3IgLk5FVDwvUHJvZHVj" +

            "dD4NCiAgICA8L1Byb2R1Y3RzPg0KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl" +

            "0aW9uVHlwZT4NCiAgICA8U2VyaWFsTnVtYmVyPjlhNTk1NDdjLTQxZjAtNDI4Yi1iYTcyLT" +

            "djNDM2OGYxNTFkNzwvU2VyaWFsTnVtYmVyPg0KICAgIDxTdWJzY3JpcHRpb25FeHBpcnk+M" +

            "jAxNTEyMzE8L1N1YnNjcmlwdGlvbkV4cGlyeT4NCiAgICA8TGljZW5zZVZlcnNpb24+My4w" +

            "PC9MaWNlbnNlVmVyc2lvbj4NCiAgICA8TGljZW5zZUluc3RydWN0aW9ucz5odHRwOi8vd3d" +

            "3LmFzcG9zZS5jb20vY29ycG9yYXRlL3B1cmNoYXNlL2xpY2Vuc2UtaW5zdHJ1Y3Rpb25zLm" +

            "FzcHg8L0xpY2Vuc2VJbnN0cnVjdGlvbnM+DQogIDwvRGF0YT4NCiAgPFNpZ25hdHVyZT5GT" +

            "zNQSHNibGdEdDhGNTlzTVQxbDFhbXlpOXFrMlY2RThkUWtJUDdMZFRKU3hEaWJORUZ1MXpP" +

            "aW5RYnFGZkt2L3J1dHR2Y3hvUk9rYzF0VWUwRHRPNmNQMVpmNkowVmVtZ1NZOGkvTFpFQ1R" +

            "Hc3pScUpWUVJaME1vVm5CaHVQQUprNWVsaTdmaFZjRjhoV2QzRTRYUTNMemZtSkN1YWoyTk" +

            "V0ZVJpNUhyZmc9PC9TaWduYXR1cmU+DQo8L0xpY2Vuc2U+";

//使用下面代碼前都加這個下面的 

// new Aspose.Slides.License().SetLicense(new MemoryStream(Convert.FromBase64String(Key)));  //這個是sldes的,其他類似

2、配套代碼(c#)

using Aspose.Cells;

using Aspose.Words;

using Aspose.Words.Fonts;

using System;

using System.Collections.Generic;

using System.Drawing;

using System.IO;

using System.Linq;

using System.Net;

using System.Net.Http;

using System.Web.Http;

using BorderType = Aspose.Cells.BorderType;


namespace manager.Controllers

{

    public class topdfController : ApiController   //webapi

    {

        public const string Key =

            "PExpY2Vuc2U+DQogIDxEYXRhPg0KICAgIDxMaWNlbnNlZFRvPkFzcG9zZSBTY290bGFuZCB" +

            "UZWFtPC9MaWNlbnNlZFRvPg0KICAgIDxFbWFpbFRvPmJpbGx5Lmx1bmRpZUBhc3Bvc2UuY2" +

            "9tPC9FbWFpbFRvPg0KICAgIDxMaWNlbnNlVHlwZT5EZXZlbG9wZXIgT0VNPC9MaWNlbnNlV" +

            "HlwZT4NCiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1p" +

            "dGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+DQogICAgPE9yZGVySUQ+MTQ" +

            "wNDA4MDUyMzI0PC9PcmRlcklEPg0KICAgIDxVc2VySUQ+OTQyMzY8L1VzZXJJRD4NCiAgIC" +

            "A8T0VNPlRoaXMgaXMgYSByZWRpc3RyaWJ1dGFibGUgbGljZW5zZTwvT0VNPg0KICAgIDxQc" +

            "m9kdWN0cz4NCiAgICAgIDxQcm9kdWN0PkFzcG9zZS5Ub3RhbCBmb3IgLk5FVDwvUHJvZHVj" +

            "dD4NCiAgICA8L1Byb2R1Y3RzPg0KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl" +

            "0aW9uVHlwZT4NCiAgICA8U2VyaWFsTnVtYmVyPjlhNTk1NDdjLTQxZjAtNDI4Yi1iYTcyLT" +

            "djNDM2OGYxNTFkNzwvU2VyaWFsTnVtYmVyPg0KICAgIDxTdWJzY3JpcHRpb25FeHBpcnk+M" +

            "jAxNTEyMzE8L1N1YnNjcmlwdGlvbkV4cGlyeT4NCiAgICA8TGljZW5zZVZlcnNpb24+My4w" +

            "PC9MaWNlbnNlVmVyc2lvbj4NCiAgICA8TGljZW5zZUluc3RydWN0aW9ucz5odHRwOi8vd3d" +

            "3LmFzcG9zZS5jb20vY29ycG9yYXRlL3B1cmNoYXNlL2xpY2Vuc2UtaW5zdHJ1Y3Rpb25zLm" +

            "FzcHg8L0xpY2Vuc2VJbnN0cnVjdGlvbnM+DQogIDwvRGF0YT4NCiAgPFNpZ25hdHVyZT5GT" +

            "zNQSHNibGdEdDhGNTlzTVQxbDFhbXlpOXFrMlY2RThkUWtJUDdMZFRKU3hEaWJORUZ1MXpP" +

            "aW5RYnFGZkt2L3J1dHR2Y3hvUk9rYzF0VWUwRHRPNmNQMVpmNkowVmVtZ1NZOGkvTFpFQ1R" +

            "Hc3pScUpWUVJaME1vVm5CaHVQQUprNWVsaTdmaFZjRjhoV2QzRTRYUTNMemZtSkN1YWoyTk" +

            "V0ZVJpNUhyZmc9PC9TaWduYXR1cmU+DQo8L0xpY2Vuc2U+";

            

        #region 把word轉化成Pdf

        //轉換成pdf

        // GET api/changepdf

        [HttpGet]

        public string changepdf(string ss)

        {

            string path = System.Web.Hosting.HostingEnvironment.MapPath(ss);   //ss是文件名  gg.docx這樣

            //return path;

            try

            {

                string inpdf = path;

                string outpdf = @"/filedata/1111.pdf";             //輸出文件

                new Aspose.Words.License().SetLicense(new MemoryStream(Convert.FromBase64String(Key)));

                string outtopdf = System.Web.Hosting.HostingEnvironment.MapPath(outpdf);   //計算出絕對路徑

                //ExcelConvert.ExcelConvertManage.StartConvert(inpdf, outpdf);

                Document doc = new Document(inpdf);

                doc.Save(outtopdf, Aspose.Words.SaveFormat.Pdf);

                return outpdf;

            }

            catch (Exception ex)

            {

                return ex.Message;

            }

        }

        #endregion

        

        #region ppt轉換為pdf

        //[Route("topdf/ppttopdf")]

        [HttpGet]

        public string ppttopdf(string ss)

        {

            string path = System.Web.Hosting.HostingEnvironment.MapPath(ss);

            //return path;

            try

            {

                string inpdf = path;

                string outpdf = @"/filedata/1111.pdf";

                new Aspose.Slides.License().SetLicense(new MemoryStream(Convert.FromBase64String(Key)));

                string outtopdf = System.Web.Hosting.HostingEnvironment.MapPath(outpdf);

                //AsposeLicenseHelper.SetSlidesLicense();

                Aspose.Slides.Presentation doc = new Aspose.Slides.Presentation(inpdf);

                doc.Save(outtopdf, Aspose.Slides.Export.SaveFormat.Pdf);

                //doc.Save(outtopdf, Aspose.Words.SaveFormat.Pdf);

                return outpdf;

            }

            catch (Exception ex)

            {

                return ex.Message;

            }

        }

        #endregion

        

        #region excel轉換成pdf

        //[Route("topdf/exceltopdf")]

        [HttpGet]

        public string exceltopdf(string ss)

        {

            string path = System.Web.Hosting.HostingEnvironment.MapPath(ss);

            //return path;

            try

            {

                string inpdf = path;

                string outpdf = @"/filedata/1111.pdf";

                new Aspose.Cells.License().SetLicense(new MemoryStream(Convert.FromBase64String(Key)));

                string outtopdf = System.Web.Hosting.HostingEnvironment.MapPath(outpdf);

                Aspose.Cells.Workbook excel = new Workbook(inpdf);

                excel.Save(outtopdf, Aspose.Cells.SaveFormat.Pdf);

                return outpdf;

            }

            catch (Exception ex)

            {

                return ex.Message;

            }

        }

        #endregion

    }

}

配套aspose.dll
鏈接:https://pan.baidu.com/s/1kOG4rK7jxDk5yUjYhNa3VQ
提取碼:g3iq

該文章在 2024/9/13 17:55:23 編輯過

全部評論1

admin
2020年4月3日 22:19
點擊生成wordtopdf

其中遇到以下錯誤:


原來是框架(.NET Framework 4 Client Profile)不合適,故換一種框架(點擊項目---wordtopdf屬性---目標框架---選擇.NET Framework 4)再次運行沒有錯誤



該評論在 2020/4/3 22:20:48 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved