Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Bookmarks with same name #335

Closed
elChapoSing opened this issue Mar 23, 2017 · 2 comments
Closed

Nested Bookmarks with same name #335

elChapoSing opened this issue Mar 23, 2017 · 2 comments
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF workflow-bookmarks From a users perspective, bookmarks is the affected feature/workflow

Comments

@elChapoSing
Copy link

elChapoSing commented Mar 23, 2017

When you try and nest several bookmarks with the same name, PyPdf2 does not take it into account. Below self-contained python code to test what I mean (you need at have 3 pdf files named a,b and c in the working folder to test it out)

from PyPDF2 import PdfMerger, PdfReader

merger = PdfMerger()
pagenum = 0
first_one = True
for file in ["a.pdf", "b.pdf", "c.pdf"]:
    print("next row")
    reader = PdfReader(file)
    merger.append(reader)
    if first_one:
        child = merger.add_bookmark(title="blabla", pagenum=pagenum)
        first_one = False
    else:
        child = merger.add_bookmark(title="blabla", pagenum=pagenum, parent=child)

merger.write("test.pdf")

I would expect the resulting pdf to have three levels of nested bookmarks

blabla
    blabla
        blabla

but instead I get

blabla
    blabla
    blabla

PS: also posted on SO http://stackoverflow.com/questions/42941742/pypdf2-nested-bookmarks-with-same-name-not-working

@MartinThoma MartinThoma added the is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Apr 8, 2022
@MartinThoma MartinThoma added the workflow-bookmarks From a users perspective, bookmarks is the affected feature/workflow label Apr 22, 2022
@MartinThoma MartinThoma added the soon PRs that are almost ready to be merged, issues that get solved pretty soon label Jun 19, 2022
@MartinThoma
Copy link
Member

Thank you for reporting the issue ❤️

It seems as if this problem got solved in the past 5 years:

image

Please let me know if that is not the case

@MartinThoma
Copy link
Member

I guess it was solved by #339

@MartinThoma MartinThoma removed the soon PRs that are almost ready to be merged, issues that get solved pretty soon label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF workflow-bookmarks From a users perspective, bookmarks is the affected feature/workflow
Projects
None yet
Development

No branches or pull requests

2 participants