Splitting a 18 MB 2 pages PDF to 2 PDF files, one for each page, gives 2 files of 18 MB each

Hello

A customer has this problem, he has a 18 Mega Bytes PDF file containing 2 pages, each one is a different image.
Then using this code to split it to two files, one for only page 1 and one for only page 2, each result file has the exact same size (18 MB) as the original file.
This results to take twice the size on disk than the original.

Here is the original file (too big to upload here) :
https://fsender.everteam.com/filesender/?s=download&token=0f8f36be-ae6e-4688-a977-0817219d0cba

And here is the code used to split, using the lib aspose-pdf-23.5.jar :
Document document = new Document();
document.getPages().add( pdfOriginal.getPages().get_Item( pagenum ) );
document.save(…);

Thank you for your help
Jean-Michel

@everteamjmf

A PDF document stores different resources and streams in it in order to retain the content inside. Once you split the document, you can optimize its size before saving to a separate file.

Yes it works very good : OptimizationOptions.setRemoveUnusedStreams(true) before doc.save() was the big win for this file :slight_smile: And it takes no time !

Thank you very much !!
Jean-Michel

@everteamjmf

It is nice to hear that your issue has been resolved. Please keep using our API and feel free to create a new topic in case you face any issues.