Skip to content

Duplicate bookmark titles under different parents point to wrong pages #1187

@wjc5197

Description

@wjc5197

Please ensure the following:

  • Your issue is based on the latest commit
    ✅️
  • State your OS and OS version
    NixOS 25.11 (Xantusia) x86_64
  • When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter

Hi, I'm facing an issue of pdf bookmarks editing: when importing bookmarks using a JSON file, if multiple parents have child bookmarks with the same title but different page numbers, those children end up pointing to incorrect pages.
For example:
bookmark-test.json:

{
  "bookmarks": [
    {
      "title": "Parent1",
      "page": 1,
      "kids": [
        {
          "title": "kid1",
          "page": 2
        },
        {
          "title": "kid2",
          "page": 3
        }
      ]
    },
    {
      "title": "Parent2",
      "page": 4,
      "kids": [
        {
          "title": "kid1",
          "page": 5
        },
        {
          "title": "kid2",
          "page": 6
        }
      ]
    }
  ]
}

and then:

pdfcpu bookmarks import -r test-process.pdf bookmark-test.json test.pdf

the result is:

Image
The expected behavior is Parent2's kid2 pointing to page 6.

Thanks in advance for your time and help!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions