翻譯|行業(yè)資訊|編輯:胡濤|2024-10-15 14:11:28.413|閱讀 59 次
概述:本文將演示如何使用Spire.PDF for .NET以編程方式從現(xiàn)有 PDF 文檔中刪除/移除頁面,歡迎查閱~
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
PDF 文檔可以包含多個頁面,這些頁面具有不同的文本內(nèi)容、圖像或其他對象。有時,用戶可能需要刪除某些頁面,這些頁面包含不正確繪制的對象或與文檔主題無關(guān)的頁面。本文將演示如何使用Spire.PDF for .NET以編程方式從現(xiàn)有 PDF 文檔中刪除/移除頁面。
Spire.PDF for .NET 是一款獨立 PDF 控件,用于 .NET 程序中創(chuàng)建、編輯和操作 PDF 文檔。使用 Spire.PDF 類庫,開發(fā)人員可以新建一個 PDF 文檔或者對現(xiàn)有的 PDF 文檔進行處理,且無需安裝 Adobe Acrobat。
E-iceblue 功能類庫Spire 系列文檔處理組件均由中國本土團隊研發(fā),不依賴第三方軟件,不受其他國家的技術(shù)或法律法規(guī)限制,同時適配國產(chǎn)操作系統(tǒng)如中科方德、中標麒麟等,兼容國產(chǎn)文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
首先,您需要將 Spire.PDF for.NET 包中包含的 DLL 文件作為引用添加到您的 .NET 項目中。 可以從此鏈接下載 DLL 文件,也可以通過NuGet安裝。
PM> Install-Package Spire.PDF
【C# 】
using Spire.Pdf; namespace RemovePage { class Program { static void Main(string[] args) { //Create a PdfDocument object PdfDocument document = new PdfDocument(); //Load a sample PDF document document.LoadFromFile(@"E:\Files\input.pdf"); //Remove the second page document.Pages.RemoveAt(1); //Save the result document document.SaveToFile("RemovePDFPage.pdf"); } } }
【VB.NET 】
Imports Spire.Pdf Namespace RemovePage Class Program Private Shared Sub Main(ByVal args As String()) 'Create a PdfDocument object Dim document As PdfDocument = New PdfDocument() 'Load a sample PDF document document.LoadFromFile("E:\Files\input.pdf") 'Remove the second page document.Pages.RemoveAt(1) 'Save the result document document.SaveToFile("RemovePDFPage.pdf") End Sub End Class End Namespace
歡迎下載|體驗更多E-iceblue產(chǎn)品
獲取更多信息請咨詢 ;技術(shù)交流Q群(767755948)
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn