Split or Get Particular Page(s) of the PDF File

Hi all,

i have a PDF with over 5000 Pages. I have to Split the PDF in Parts. But i need to Split in dynamic Steps. Not Save One Page to a new PDF, maybe two or three Pages must be save to a new PDF. In Aspose.PDF for .NET Documentation|Aspose.PDF for .NET is a Sample to save only one Page into a new Page.

Is it possible to save page No. 3,4,5 and 6 to One new Page in One Step?

Now i Save each Page in a own PDF and add the other Pages like this Sample to the first one: Concatenate PDF documents in C#|Aspose.PDF for .NET

Thanks and Regards
Winfried

Hi Winfried,

Thanks for your inquiry. Please check the following code snippet to extract more than one page using the DOM approach. You can also extract multiple pages using the Facades approach as suggested here. Hopefully, it will help you accomplish your requirements.

Document wholePdf = new Document(myDir + "s3.pdf");
Document extractedPdf = new Document();
int pagecount = 1;
foreach (Page page in wholePdf.Pages)
{
   if (pagecount > 2 && pagecount < 7)
   {
       extractedPdf.Pages.Add(page);
   }
   pagecount++;
}
extractedPdf.Save(myDir + "extractPages.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

Thank you Tilal,

this Extract PDF pages|Aspose.PDF for Java is the solution for me. :wink:

Thanks and Regards
Winfried

Hi Winfried,


Thanks for your acknowledgement. I am pleased to hear that your requirement can be accomplished using above shared link. However we recommend you to please try using the Document Object Model of Aspose.Pdf namespace as compare to Aspose.Pdf.Facades.

Anyways, in the event of any further query, please feel free to contact.