To split PDF pages using PdfSharp in C# you can use the PdfDocument
class from the library. First, create an instance of PdfDocument
class and load the PDF document you want to split. Then loop through the pages you want to extract and add them to a new PdfDocument
instance. Finally, save the extracted pages as a new PDF document.
Here is an example code snippet that demonstrates how to split PDF pages using PdfSharp in C#:
main.cs898 chars26 lines
To use this method, you can call it with the input PDF file path, the start and end page numbers you want to extract, and the output file path for the resulting PDF document:
main.cs172 chars7 lines
This will extract pages 1 to 3 from the input PDF document and save them as a new PDF document at the specified output file path.
gistlibby LogSnag