We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to split pdf file into multiple files ??

I'm trying to create a pdf viewer page with split options, I want to upload a pdf file and split into multiple pdf files.
I already used syncfusion to create pdf viewer sample but the issue now is that i cant split it into multiple pdf files !!! 
Are there any samples that can be helpful ?? 
Thank you.

5 Replies

RT Ramya Thirugnanam Syncfusion Team July 5, 2019 06:19 AM UTC

Hi Mootaz, 
 
Thanks for contacting Syncfusion support. 
 
At present, PDF Viewer control does not support splitting of a PDF document into multiple files. However, we can achieve this by using Syncfusion PDF library in the code behind of the application. Please find the documentation link for splitting the document into multiple files using Syncfusion PDF library below. 
 
 
Could you please confirm us whether your requirement is to split the pages in the UI of the PDF Viewer control or in the code behind of the application? It will be helpful for us to analyze further and assist you better. 
 
Regards,  
Ramya T 



MA Mootaz Abdellatif July 5, 2019 07:55 AM UTC

Hi Ramya T,
Thank you for your help.
I'm actually trying to split the pages in the UI of the PDF viewer control and not in the code behind the application.
If there is an API or library other than PDF Viewer control to split the pages in the PDF please inform me, that could be very helpful.
Regards
Mootaz A




RT Ramya Thirugnanam Syncfusion Team July 5, 2019 10:29 AM UTC

Hi Mootaz, 
 
Thank you for your update. 
 
At present, EJ2 PDF Viewer control does not support splitting the PDF pages into multiple files. Can you please confirm us whether you are trying to split the pages like in the Acrobat PDF Viewer? However, we have added this feature to our features request list. It can be tracked through our feature management system. 
 
 
We do not have immediate plans to implement this feature. This feature will be available in any of our upcoming releases. 
 
Regards,  
Ramya T 



VE Venkat replied to Ramya Thirugnanam April 7, 2021 11:05 AM UTC

Hi Mootaz, 
 
Thank you for your update. 
 
At present, EJ2 PDF Viewer control does not support splitting the PDF pages into multiple files. Can you please confirm us whether you are trying to split the pages like in the Acrobat PDF Viewer? However, we have added this feature to our features request list. It can be tracked through our feature management system. 
 
 
We do not have immediate plans to implement this feature. This feature will be available in any of our upcoming releases. 
 
Regards,  
Ramya T 


HI  All,

Below Refence code  i am using asp.net core 3.1 but facing some reference issue ,like below

PdfDocument' does not contain a definition for 'ImportPage' and no accessible extension method 'ImportPage' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?) .net core

https://www.syncfusion.com/blogs/post/6-easy-ways-to-split-a-pdf-document-using-c.aspx


https://help.syncfusion.com/file-formats/pdf/working-with-pages?cs-save-lang=1&cs-lang=asp.net%20core

Kindly share the details
 


VS Vasugi Sivajothi Syncfusion Team April 8, 2021 05:00 PM UTC

Hi Venkat, 
 
The PDF document can be split into individual pages or a range of pages using ImportPage method as shown in below code snippet in .Net core platform.  Please refer the below code snippet,  
//Load the PDF document.  
            FileStream docStream = new FileStream(DataPathBase + "Sample.pdf", FileMode.Open, FileAccess.Read);  
  
            PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);  
  
            for (int i = 0; i < loadedDocument.PageCount; i++)  
             
  
                //Creates a new document  
  
                PdfDocument document = new PdfDocument();  
  
                //Imports the pages from the loaded document  
  
                document.ImportPage(loadedDocument, i);  
  
                //Create a memory stream   
  
                MemoryStream stream = new MemoryStream();  
  
                //Save the document to stream  
  
                document.Save(stream);  
  
                stream.Position = 0;  
  
                //Close the document  
  
                document.Close(true);  
  
                //Create a file stream  
  
                FileStream fileStream = new FileStream(DataPathOutput + "ImportPage_Output"+ i + ".pdf", FileMode.Create, FileAccess.Write);  
  
                byte[] bytes = stream.ToArray();  
  
                //Write bytes to file  
  
                fileStream.Write(bytes, 0, (int)bytes.Length);  
  
                //Dispose the streams  
  
                stream.Dispose();  
  
                fileStream.Dispose();  
  
             
   
We have created a sample for the same and this can be found in below link:    
  
  
Kindly try the same and let us know if you need any further information on this.     
  
Regards, 
Vasugi 
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon