Cannot extract pages using 6.01

I am trying to use your example code to extract a page of a fax and save it in a document. I am getting a null reference. Can you please let me know as quickly as possible what we need to do. I have very little time to finish this project.

Here is the code. See the attached image for the error.

private void Form1_Load( object sender, EventArgs e )
{
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense("FaxTest.Aspose.Pdf.lic");
//open the pdf
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(@"c:\test2.pdf");
//iterate through the pages
foreach(Aspose.Pdf.Page page in pdf.Pages)
{
//create the new document
Aspose.Pdf.Document newPDF = new Aspose.Pdf.Document();
//add the page
newPDF.Pages.Add(page); <---ERROR OCCURS HERE
//save the file
newPDF.Save(@"C:\test-page" + page.Number.ToString() + ".pdf");
}
}

Hi Richard,

I am testing the sample code using Aspose.Pdf for .NET v6.1.0 and I am not able to reproduce the issue. The page extraction code works fine. Please share your template file to reproduce the issue and we will check it to figure out the issue.

Sorry for the inconvenience caused,

Hi Richard,

Thanks for using our products.

I have gone through the code snippet that you have shared but I am afraid I am unable to understand your requirement. Do you need to add some pages into existing PDF document or do you need to extract images from PDF document or you need to convert the pages of PDF document into image format. Please share some details so that we can respond accordingly. We apologize for your inconvenience.