特定のPDFページを削除する

PDF ドキュメントから 1 ページまたは複数のページを削除するには、removePage メソッドを使用してください。 編集した PDF ドキュメントは、PDF ファイルをプログラムで作成、編集、操作できる.NET用の強力な PDF ライブラリであるIronPDFの saveAs メソッドを使用してエクスポートできます。 IronPDFの機能については、IronPDF公式ウェブサイトで詳しく学べます。

説明:

  • IronPdf: このコードはIronPdfを使用しており、PDF操作のため for .NETライブラリです。 プロジェクトにこのライブラリがインストールされていることを確認してください。

  • PdfDocument.FromFile(inputPath): This loads the PDF from the given file path into a PdfDocument object.

  • RemovePage(0): This method is called on the PdfDocument object to remove the first page of the PDF. Page numbering starts with 0, so 0 represents the first page.

  • SaveAs(outputPath): Any changes made to the PdfDocument object are saved to a new file specified by outputPath.

  • Console.WriteLine: 修正されたPDFの場所を示す完了メッセージをコンソールに出力します。

Keep in mind to replace "input.pdf" and "output.pdf" with your actual file paths.

IronPDFでPDFページを削除するGitHubの例を見る

準備はできましたか?
バージョン: 2026.3 リリース
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか?
サンプルを実行するHTML が PDF に変換されるのを確認します。