跳過到頁腳內容
PDF工具

如何將PowerPoint轉換為PDF

愛它們或厭惡它們,PowerPoint 投影片展示是日常辦公生活的一部分。然而,在展示和共享時,可能會出現很多問題。 引入全能的 PDF - 一種普遍支持的格式,能夠保留原始文件的佈局。

在本指南中,我們將解釋如何使用我們功能豐富的 C# 程式庫 IronPDF 來轉換 PPT 為 PDF,並推薦一些提供基本功能的替代轉換工具。

IronPDF:頂尖 C# PDF 程式庫

IronPDF是一款輕量級的.NET PDF程式庫,專為網頁開發人員設計。 PDF 轉換只是眾多用途之一 - 它讓閱讀、寫入和操作 PDF 變得輕鬆,您可以在桌面和網頁的 .NET 專案中使用它。 最棒的部分 - 在開發環境中免費試用。

IronPDF的主要優勢之一是其靈活性。 它可以作為獨立的桌面應用程式使用,也可以使用IronPDF API整合到您的網頁應用程式中。 此外,IronPDF 與 Windows、Mac 和 Linux 作業系統兼容,使其對廣大用戶來說更具可達性。

PPT 轉換為 PDF - 入門指南

在 Visual Studio 中創建您的專案

首先,打開 Visual Studio,進入文件 -> 新建專案 -> 控制台應用程式。 輸入專案名稱,選擇要保存的位置,然後點擊下一步按鈕。 選擇最新的 .NET Framework,然後創建。 一旦專案啟動運行,就可以添加我們的程式庫了。

安裝 IronPDF 程式庫

IronPDF 使用簡單,但安裝更簡單。 有幾種方法可以做到這一點:

方法 1:NuGet 套件管理器控制台

在 Visual Studio 的方案總管中,右鍵點擊參考項,然後點擊管理 NuGet 套件。 點擊搜索並尋找 'IronPDF',並安裝最新版本。 如果您看到這個,表示它正在運行:

如何將 PowerPoint 轉換為 PDF:圖 1

您也可以去工具 -> NuGet 套件管理器 -> 套件管理器控制台,並在套件管理器選項卡中輸入以下行:

Install-Package IronPdf

最後,您可以直接從NuGet 上的 IronPDF 套件獲取 IronPDF。 從頁面右側菜單中選擇下載套件選項,雙擊下載自動安裝,並重新加載解決方案以便在專案中使用。

不起作用? 您可以在我們的IronPDF 的 NuGet 安裝指南中找到特定平台的幫助。

方法 2:使用 DLL 檔案

您還可以直接從我們這裡獲取 IronPDF DLL 檔案並手動將其添加到 Visual Studio 中。 如需完整說明和到 Windows、MacOS 和 Linux DLL 套件的連結,請查看我們的IronPDF DLL 安裝指南

添加 IronPDF 命名空間

務必記得用 IronPDF 命名空間啟動您的代碼,如下所示:

using IronPdf;
using IronPdf;
$vbLabelText   $csharpLabel

如何使用 IronPDF 將 PPT 轉換為 PDF

將 PowerPoint 投影片轉換為 HTML

IronPDF 從 HTML 生成像素完美的 PDF,因此我們必須先將 PPT 轉換為 HTML。不幸的是,Microsoft PowerPoint 不支持直接將文件導出為 HTML,因此我們需要使用線上轉換工具。 我們選擇了Zamzar 的 PPT 到 HTML 轉換器 - 只需上傳您的 PPT,選擇 HTML,然後點擊立即轉換。

將 HTML 轉換為 PDF

現在,為了開始將 HTML 文件轉換為 PDF,在 Visual Studio 中初始化 ChromePdfRenderer 物件。 像這樣:

// Initialize a new instance of ChromePdfRenderer
var renderer = new ChromePdfRenderer();
// Initialize a new instance of ChromePdfRenderer
var renderer = new ChromePdfRenderer();
$vbLabelText   $csharpLabel

然後,使用 RenderHtmlFileAsPdf 方法將 HTML 文件轉換為 PDF,並在這裡指定文件路徑:

// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf(@"C:\Presentation\Presentation.html");
// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf(@"C:\Presentation\Presentation.html");
$vbLabelText   $csharpLabel

最後,使用 SaveAs 方法保存 PDF:

// Save the rendered PDF to the specified path
pdf.SaveAs(@"C:\PptToPdf.pdf");
// Save the rendered PDF to the specified path
pdf.SaveAs(@"C:\PptToPdf.pdf");
$vbLabelText   $csharpLabel

這就是它 - 用幾行代碼,您的 PowerPoint 文件現在已轉換為 PDF 文件:

如何將 PowerPoint 轉換為 PDF:圖 2

為 PDF 文件添加浮水印、密碼和標題

然而,IronPDF 的功能不止於此 - 我們功能齊全的程式庫可供您微調和自定義您的演示文稿。

如何使用 IronPDF 向 PDF 添加浮水印

本節展示如何使用IronPDF 的 ApplyStamp 方法在 PDF 中添加作為郵票圖像的浮水印。

// Add a stamped image as a watermark in the PDF
pdf.ApplyStamp(new ImageStamper("https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg"));
// Add a stamped image as a watermark in the PDF
pdf.ApplyStamp(new ImageStamper("https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg"));
$vbLabelText   $csharpLabel

如何使用 IronPDF 向 PDF 添加密碼保護

為 PDF 添加密碼可防止未經授權的訪問。 您可以為用戶和管理員設置不同密碼,以允許定制訪問。

// Set the password for the PDF document
pdf.Password = "EasyPassword";
// Set the password for the PDF document
pdf.Password = "EasyPassword";
$vbLabelText   $csharpLabel

如何使用 IronPDF 向 PDF 添加 HTML 標題

HtmlHeaderFooter 物件為您的演示添加最後的修飾。

// Configure the header for the PDF document
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    MaxHeight = 20, // Millimeters
    HtmlFragment = "<h1>Headers are easy with IronPDF!</h1>",
};
// Configure the header for the PDF document
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    MaxHeight = 20, // Millimeters
    HtmlFragment = "<h1>Headers are easy with IronPDF!</h1>",
};
$vbLabelText   $csharpLabel

以下是所有內容的整體樣子:

using IronPdf;
using IronPdf.Editing;

// Initialize a new instance of ChromePdfRenderer
var renderer = new ChromePdfRenderer();

// Configure the header for the PDF document
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    MaxHeight = 20, // Millimeters
    HtmlFragment = "<h1>Headers are easy with IronPDF!</h1>",
};

// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf(@"C:\Presentation\Presentation.html");

// Add a stamped image as a watermark in the PDF
pdf.ApplyStamp(new ImageStamper("https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg"));

// Set the password for the PDF document
pdf.Password = "EasyPassword";

// Save the rendered PDF to the specified path
pdf.SaveAs(@"C:\PptToPdf.pdf");
using IronPdf;
using IronPdf.Editing;

// Initialize a new instance of ChromePdfRenderer
var renderer = new ChromePdfRenderer();

// Configure the header for the PDF document
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    MaxHeight = 20, // Millimeters
    HtmlFragment = "<h1>Headers are easy with IronPDF!</h1>",
};

// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf(@"C:\Presentation\Presentation.html");

// Add a stamped image as a watermark in the PDF
pdf.ApplyStamp(new ImageStamper("https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg"));

// Set the password for the PDF document
pdf.Password = "EasyPassword";

// Save the rendered PDF to the specified path
pdf.SaveAs(@"C:\PptToPdf.pdf");
$vbLabelText   $csharpLabel

這是最終產品:

如何將 PowerPoint 轉換為 PDF:圖 3

替代的 PPT 到 PDF 轉換工具

有很多免費且有限的工具,可以讓您轉換 PowerPoint 投影片,包括在線創建 PDF 的方式。以下是一些替代的 PPT 到 PDF 轉換器選項。

Microsoft PowerPoint

Microsoft PowerPoint 多年來一直是投影片展示的基石,並允許您輕鬆將文檔導出為 PDF。 然而,它缺乏上述步驟中所描述的自定義功能。

如何使用 Microsoft PowerPoint 將 PPT 轉換為 PDF

  • 在 Microsoft PowerPoint 中打開您的 PPT 文件
  • 點擊 文件,然後 另存為,選擇 .pdf

Soda PDF

Soda PDF 是一個在線工具,允許您轉換 PPT 為 PDF,並提供許多其他功能。 然而,與本清單中的其他工具不同,它不是免費使用的。

如何使用 Soda PDF 轉換器將 PPT 轉換為 PDF

  • 前往Soda PDF 轉換器並點擊選擇檔案
  • 上傳您要轉換的 PPT 文件
  • 一旦處理完畢,點擊下載以獲取您的文件或輸入電子郵件以發送

Adobe Acrobat Reader

PDF格式的創造者,Adobe 在生成PDF方面被公認為行業標準。 他們的免費在線工具可以讓您將PPT文件轉換為PDF,但有限的自定義選項需要付費訪問。

如何使用 Adobe Acrobat Reader 將 PPT 轉換為 PDF

SmallPDF

SmallPDF 是一個受歡迎的在線工具,提供一系列 PDF 編輯功能,包括將 PPT 轉換為 PDF 的能力。 SmallPDF 的主要優勢之一是其便利性。 由於它是基於網頁的工具,您可以從任何具有網際網路連接的設備訪問它,而無需下載或安裝任何軟體。

如何使用 SmallPDF 將 PPT 轉換為 PDF

結論

Microsoft Word、Adobe 和在線轉換工具易於使用,並提供一系列基本編輯功能。 然而,對於更強大的 PDF 修訂工具,IronPDF 提供無與倫比的靈活性。

而 PPT 至 PDF 轉換僅僅是個開始 - 具有 PDF 格式化工具、內建安全和合規功能等,IronPDF 是您所有 PDF 文件需求的首選工具。

準備好體驗IronPDF了嗎? 您可以從我們的IronPDF 30天免費試用開始。 它在開發目的中完全免費使用,讓您可以真正了解其功能。 如果您喜歡您所見,IronPDF 起價只需$Lite 授權。 想要更大的節省,請查看Iron Suite 捆綁方案,您可以用兩款價格獲得九款 Iron Software 工具。 祝您編碼愉快!

如何將 PowerPoint 轉換為 PDF:圖 1

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me