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
//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();
} |