怎么在asp.net中將ppt文檔轉(zhuǎn)換成pdf-創(chuàng)新互聯(lián)

本篇文章為大家展示了怎么在asp.net中將ppt文檔轉(zhuǎn)換成pdf,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。

成都創(chuàng)新互聯(lián)公司長期為近千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為金東企業(yè)提供專業(yè)的網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì),金東網(wǎng)站改版等技術(shù)服務(wù)。擁有10多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

一、添加引用


復(fù)制代碼 代碼如下:

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

二、轉(zhuǎn)換方法

復(fù)制代碼 代碼如下:

///<summary>       
/// 把PowerPoint文件轉(zhuǎn)換成PDF格式文件      
///</summary>       
///<param name="sourcePath">源文件路徑</param>    
///<param name="targetPath">目標(biāo)文件路徑</param>
///<returns>成功返回true,失敗返回false</returns>
public static bool PPTConvertToPDF(string sourcePath, string targetPath)
{
        bool result;
        PpSaveAsFileType ppSaveAsFileType = PpSaveAsFileType.ppSaveAsPDF;//轉(zhuǎn)換成pdf
        object missing = Type.Missing;
        Microsoft.Office.Interop.PowerPoint.ApplicationClass application = null;
        Presentation persentation = null;
        try
        {
            application = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
            persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
            if (persentation!=null)
            {
                persentation.SaveAs(targetPath, ppSaveAsFileType, MsoTriState.msoTrue);
            }
            result = true;
        }
        catch
        {
            result = false;
        }
        finally
        {
            if (persentation != null)
            {
                persentation.Close();
                persentation = null;
            }
            if (application != null)
            {
                application.Quit();
                application = null;
            }
        }
        return result;
}

三、調(diào)用


復(fù)制代碼 代碼如下:

OfficeToPdf.PPTToPDF("d:\\12345.pptx", "d:\\12345.pdf");

上述內(nèi)容就是怎么在asp.net中將ppt文檔轉(zhuǎn)換成pdf,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲(chǔ)備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

文章標(biāo)題:怎么在asp.net中將ppt文檔轉(zhuǎn)換成pdf-創(chuàng)新互聯(lián)
URL標(biāo)題:http://bm7419.com/article38/cedepp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、品牌網(wǎng)站制作、網(wǎng)站建設(shè)、手機(jī)網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、域名注冊

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司