Usuń określone strony z pliku PDF

Aby usunać pojedyncze lub wiele stron z dokumentu PDF, nalezy uzyc metody removePage. Edytowany dokument PDF mozna nastepnie wyeksportowac, korzystajac z metody saveAs IronPDF, potężnej biblioteki PDF dla .NET, ktora pozwala tworzyc, edytowac i manipulowac plikami PDF programowo. Mozesz dowiedziec sie wiecej o funkcjach IronPDF na oficjalnej stronie IronPDF.

Wyjaśnienie:

  • IronPdf: Kod wykorzystuje IronPdf, biblioteke .NET do manipulacji PDF. Upewnij sie, ze ta biblioteka jest zainstalowana w twoim projekcie.

  • 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: Wyswietla komunikat o ukonczeniu w konsoli, wskazujac lokalizacje zmodyfikowanego PDF.

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

Odkryj przyklady GitHub dotyczace usuwania stron PDF za pomoca IronPDF

Gotowy, aby rozpocząć?
Wersja: 2026.4 just released
Still Scrolling Icon

Wciąż przewijasz?

Czy chcesz szybko dowodu?
Uruchom przykład i zobacz, jak Twój kod HTML zamienia się w plik PDF.