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");
}
}