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

Free Support Forum - aspose.com

Corrupted Pages when Splitting PDF File

Hi ASPOSE Support,

We use Aspose.PDF to split PDF file. For most files, the result pages are good. But for some files, the result pages are black, and Aspose.PDF does not return any error.

Attaches are original file and result page files. We use VS 2017, .NET 4.8.03761, Aspose.PDF 18.6.0.0. The following are the codes

                    string dstFilenameOnly = dstfilename.Remove(dstfilename.LastIndexOf('.'));
                    Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(srcFileName);

                    foreach (Page pdfPage in pdfDocument.Pages)
                    {
                        Aspose.Pdf.Document newDocument = new Aspose.Pdf.Document();
                        newDocument.Pages.Add(pdfPage);
                        var saveFileName = dstFilenameOnly + "_pg" + pdfPage.Number.ToString().PadLeft(3, '0') + ".pdf";
                        newDocument.OptimizeResources(new Document.OptimizationOptions()
                        {
                            LinkDuplcateStreams = true,
                            RemoveUnusedObjects = true,
                            RemoveUnusedStreams = true,
                            CompressImages = true,
                            ImageQuality = 10
                        });
                        newDocument.Save(saveFileName);
                        fileNames.Add(saveFileName);
                    }

Could you give us the solution for this issue?

Thanks,
Yan

Original.pdf (418.9 KB)
upload_74587_pg001.pdf (36.9 KB)
upload_74587_pg002.pdf (117.0 KB)
upload_74587_pg003.pdf (91.6 KB)
upload_74587_pg004.pdf (58.1 KB)
upload_74587_pg005.pdf (58.7 KB)

@tuyan2001

Thank you for contacting support.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-47454 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.