Free Support Forum - aspose.com

How can I split a PDF into multiple PDFs

Hi,

I have a PDF file of 10 pages . I need to split this into 5 PDFs of 2 page each.

How can I achieve this ?

I am using Java 2.7.0 and 3.7.0 PDF Kit.

The main PDF is having the book mark and I need to maintain that bookmark in the split files also. Is it possible ?

Hi Sriman,

You can extract the required set of pages using extract method of PdfFileEditor class by passing the pages you want to extract as integer array. This way you can create 5 new PDF files of 2 pages each.

However, I’m afraid, it is not feasible to split the bookmarks along with the files. You’ll have to create the new bookmarks for the newly created PDF files.

I hope this helps. If you find any further questions, please do let us know.
Regards,


Hi,

When I split a PDF with regular texts inside then its splitting perfectly. But if it contains images, graphs etc then the split files geting bulky.

i.e. the main file is 1 MB , 49 pages .

I am splitting it into 2 files of 25 pages and found both the files coming as 1 MB each.

Why the split files are getting bulkier than the original ? Is there any way by which I can compress the size ?

This is a BIG problem for me when I split a bigger file of 10 MB and finding 2 files with 10 MB each.

Code Template :

PdfFileEditor pdfFileEditor = new PdfFileEditor();

pdfFileEditor.extract(inputFile, pageArray, splitFileName);

I am using Java 2.7.0, pdf kit 3.7.0. I tried the Settings.setCompressionLevel() but didn't get any success.

Hi Sriman,

We’re investigating this issue at our end. Please spare us some time and you’ll be updated with the results shortly.

We’re sorry for the inconvenience.
Regards,

Hi Sriman,

I have reproduced this problem at my end and logged it as PDFKITJAVA-30395 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,