How to Fix PDF Splitting Errors Caused by Duplicate Bookmark Names
Question details
The user is unable to successfully split a PDF document by its top-level bookmarks because multiple bookmarks share identical names, resulting in file overwrites or failed split operations.

- Product
- PDF Editor
- Device & OS
- Windows
- Scenario
- Attempting to extract sections of a large PDF into individual files automatically named after the document's top-level bookmarks.
- Observed behavior
- The PDF splitting process overwrites existing files because the application tries to save multiple files with the exact same name, as Windows does not automatically append numbers to programmatically generated duplicate filenames.
Before attempting to split your PDF, expand the bookmark navigation pane to visually scan for any identically named top-level bookmarks.
Use Custom JavaScript to Auto-Rename Duplicate Bookmarks
Execute a custom script within your advanced PDF editor to automatically detect identical bookmark names and append unique alphanumeric suffixes.
When an application splits a PDF by bookmarks, it relies on the bookmark names to generate filenames. Because the Windows operating system does not automatically append unique numbers when a program saves duplicate filenames, the application will simply overwrite the earlier file. To prevent this, every top-level bookmark must be unique before initiating the split.
Launch your PDF application (such as Adobe Acrobat), navigate to the Tools menu, and open the JavaScript Debugger or Console.
Enter a custom JavaScript function designed to iterate through the top-level bookmark tree. The script should identify duplicate strings and append a unique identifier (e.g., adding '_1', '_2') to each identical bookmark name.
Once the script finishes renaming the bookmarks, go to the document extraction settings and select 'Split by Top-Level Bookmarks'. The application will now generate distinct, non-overlapping files.

Manually Rename Bookmarks Before Splitting
Manually edit the duplicate bookmark names directly from the navigation pane to ensure no two top-level sections share the same title.
Manage Bookmarks and Split PDFs Easily with WPS Office
WPS Office offers a comprehensive, easy-to-use PDF editor that allows you to intuitively manage bookmarks, rename duplicates visually, and split PDFs without relying on complex scripts.
- 1. Open the PDF in WPS Office: Launch WPS Office on your computer and open the PDF document you wish to split.
- 2. Modify Duplicate Bookmarks: Click the Bookmark icon on the left navigation pane. Right-click any duplicate bookmarks and rename them so every top-level title is unique.
- 3. Use the Split PDF Feature: Navigate to the 'Page' tab on the top ribbon and select 'Split PDF'. Choose your preferred extraction method to safely divide your document into separate files.

Frequently Asked Questions
Why does my PDF editor overwrite files when splitting by bookmarks?
When splitting a PDF, the software uses the top-level bookmark names as the new filenames. If multiple bookmarks have the same name, the software attempts to save multiple files with identical names. Depending on its save behavior and permissions, it will continually overwrite the existing file instead of creating a new one.
Doesn't Windows automatically add numbers like (1), (2) to duplicate files?
Windows automatically appends numbers when a user manually copies and pastes a file with an identical name in File Explorer. However, when an application programmatically creates and saves files during a batch process like PDF splitting, the operating system does not automatically intervene to rename them.
Do I need to rename nested sub-bookmarks as well?
If you are only splitting the document by top-level bookmarks, you only need to ensure the top-level bookmark names are unique. The names of nested sub-bookmarks will not affect the file naming process during the split.




