We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Corrupted Split PDF Not Throwing Any Error

I have the below codes to split PDF into single page PDF's. It works for most of my images. But I encountered a few PDF's that Aspose generates the single pages without throwing any error and they cannot be opened with Adobe Reader.

string inputFile = @"C:\temp\problem images\32429797.pdf";
using (Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(inputFile))
int pageCount = 1;
int n = pdfDoc.Pages.Count;

foreach (Aspose.Pdf.Page pdfPage in pdfDoc.Pages)
using (Aspose.Pdf.Document newDoc = new Aspose.Pdf.Document())
newDoc.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true
//CompressImages = true,
//ImageQuality = 10
string outFile = @"C:\temp\test\test_" + pageCount.ToString().PadLeft(n.ToString().Length, '0') + ".pdf";

When I subsequently open the PDF from Adobe Reader, I get "An error exists on this page. Acrobat may not display the page correctly..." If I use a Aspose.Pdf.Document object to re-open the file, it opens it without generating error.

Hi Mary,

Thanks for your inquriy. We will appreciate it if you please share your sample problematic PDF document here, so we will test the scenario and will update you accordingly.

We are sorry for the inconvenience caused.

Best Regards,