PDF Editing Issues

How to Split PDFs by Bookmarks with Numbered Filenames

John WilsonJohn Wilson Nov 3, 2026 869 views

Question details

The user wants to split a large PDF document using its top-level bookmarks while ensuring the resulting files are sorted sequentially in Windows Explorer.

How to Split PDFs by Bookmarks with Numbered Filenames
Product
PDF Editor
Device & OS
Windows
Scenario
Splitting a large PDF document into smaller, individual files based on existing bookmarks without losing chronological order.
Observed behavior
By default, splitting by bookmark names results in alphabetically sorted files in Windows, which ruins the original reading sequence unless numbered prefixes are added.
Before you start

Ensure your PDF document already has the necessary top-level bookmarks properly set up. It is highly recommended to back up your original PDF file before running any batch renaming scripts or split actions.

Solution 1Recommended

Rename Bookmarks with Numbered Prefixes Before Splitting

Add a zero-padded number sequence to each bookmark name (e.g., 01_BookmarkName) so that extracted files maintain their proper chronological order in Windows Explorer.

Windows Explorer sorts files alphabetically by default. If you split a PDF using the original text-based bookmark names, the output files will likely lose their original chronological order. To prevent this, you must append sequential numbers to the bookmarks before the splitting process.

1
Access JavaScript tools in your PDF editor

Open your PDF in an advanced PDF editor (such as Adobe Acrobat) and navigate to the Action Wizard or JavaScript console.

2
Run the bookmark renaming script

Execute a JavaScript snippet that loops through bookmarkRoot.children. The script should calculate the necessary prefix length based on the total number of bookmarks and rename each using a zero-padded sequence (for example, using util.printf to add '01_', '02_', etc.).

3
Save the modified document

Add a Save command to your batch action, or manually save the PDF document to ensure the new sequential bookmark names are permanently applied.

4
Split the PDF by bookmarks

Use the 'Split Document' feature in your software, select the option to split by 'Top-level bookmarks', and choose to use the bookmark names as the output filenames.

Rename Bookmarks with Numbered Prefixes Before Splitting
Why Zero-Padding is Crucial: If you have more than 9 bookmarks, use at least two digits (01, 02) to ensure files 10 and 11 sort correctly after 09 in Windows. Use three digits (001, 002) if your document contains over 99 bookmarks.

Split and Manage PDF Pages Easily with WPS Office

WPS PDF provides an intuitive and powerful interface to extract, split, and manage PDF pages without the need for complex JavaScript codes. You can effortlessly split large documents, organize your files visually, and rename sections manually.

  1. 1. Open your PDF in WPS Office: Launch WPS Office on your computer and open the large PDF document you want to divide.
  2. 2. Access the Split PDF Tool: Navigate to the 'Page' tab on the top menu ribbon and click on the 'Split PDF' button.
  3. 3. Configure your Split Settings: Choose your preferred splitting method in the dialog box (such as splitting by custom page ranges) and select your desired output folder.
  4. 4. Extract and Save: Click the 'Split' button to instantly separate your large document into smaller, sequentially ordered files.
Easily split large PDFs into multiple files by specific page range, page count, or file size.Fully compatible with standard PDF formats and Adobe Acrobat files.Visual page management allows simple drag-and-drop page extraction.Built-in bookmark editor to quickly rename and organize PDF sections before exporting.
microsoft office alternative - wps office

Frequently Asked Questions

Why are my split PDF files out of order in Windows Explorer?

Windows Explorer sorts files alphabetically or numerically based on the filename. If your original PDF bookmarks started with letters instead of numbers, Windows will sort the extracted files alphabetically, disrupting the document's original reading order.

Can I rename bookmarks manually instead of using a JavaScript?

Yes. If your document only has a few top-level bookmarks, you can right-click each bookmark in your PDF editor's bookmark panel, select 'Rename', and manually type '01_', '02_', etc., before executing the split command.

Does zero-padding matter if I have fewer than 10 bookmarks?

If you are absolutely certain you will never exceed 9 bookmarks, standard numbering (1, 2, 3) works. However, using zero-padding (01, 02) is a best practice, as Windows will sort '10' right after '1' if the zero is missing, breaking the sequence.

Will splitting a PDF by bookmarks reduce the quality of the text or images?

No. Splitting a PDF by bookmarks simply extracts the existing pages into separate files. The original resolution, text formatting, and image quality of the document are perfectly preserved in the output files.