Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
im using aspose pdf for splitting the file as per input given by the user of page numbers
This code which i have written is working fine for the first four pages but when i try to split the 5th page or if i try to split page number > 4 then it shows an error
"At most 4 elements (for any collection) can be viewed in evaluation mode."

What I have tried:

C#
string sourcePdfPath = @"F:\SplitPDF\SplitPDF\Main File\pdffile.pdf";
            string outputPdfPath = @"F:\SplitPDF\SplitPDF\Main File\";
            string pages = txtpagenumbers.Text;
            int[] extractThesePages = pages.Split(',').Select(n => Convert.ToInt32(n)).ToArray();
            Document pdfDocument = new Document(sourcePdfPath);
           int pageCount =  pdfDocument.Pages.Count;
            Document newDocument = new Document();
            foreach (int i in extractThesePages)
            {
                Page pdfPage = pdfDocument.Pages[i];
                newDocument.Pages.Add(pdfPage);
            }
            generatepassword();
            string fname =    "page_"+randfilenu+"_"+DateTime.Now.ToShortDateString()+".pdf";
            newDocument.Save(outputPdfPath + fname );
            MessageBox.Show("Splitted File has been Created and saved to folder: \n" + outputPdfPath + fname);
Posted
Updated 13-Feb-16 6:50am
v2

1 solution

It's a commercial tool and you have an evaluation copy of it. Evaluation copies almost always have some sort of restriction in usability and here you're hitting it. So either deal with it or buy a licensed copy or look for alternative (potentially free) solutions.
 
Share this answer
 
Comments
BillWoodruff 14-Feb-16 1:29am    
A "perfect" response, Sascha, but should this be posted as a "solution," rather than a comment ?
Sascha Lefèvre 14-Feb-16 9:41am    
You're probably right :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900