移除特定的 PDF 頁面
若要從 PDF 文件中刪除單一或多個頁面,請使用removePage方法。 然後可以使用 IronPDF 的saveAs方法匯出編輯後的 PDF 文件。 IronPDF 是一個功能強大的 .NET PDF 程式庫,可讓您以程式設計方式建立、編輯和操作 PDF 檔案。 您可以在IronPDF 官方網站上了解更多關於 IronPDF 的功能資訊。
說明:
IronPdf :該程式碼使用了 IronPdf,這是一個用於 PDF 處理的 .NET 程式庫。 請確保您的專案中已安裝此程式庫。
PdfDocument.FromFile(inputPath): This loads the PDF from the given file path into a
PdfDocumentobject.RemovePage(0): This method is called on the
PdfDocumentobject to remove the first page of the PDF. Page numbering starts with 0, so0represents the first page.SaveAs(outputPath): Any changes made to the
PdfDocumentobject are saved to a new file specified byoutputPath.- Console.WriteLine :向控制台列印完成訊息,指示修改後的 PDF 的位置。
Keep in mind to replace "input.pdf" and "output.pdf" with your actual file paths.




