Skip to content

Conversation

@mainuddin-md
Copy link
Contributor

This adds documentation for reading and adding PDF outlines/bookmarks
as requested in issue #3484. Linked in User Guide.

Copy link
Collaborator

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

  • Please have a look at the failing tests.
  • Please move user docs to the user-specific directory.

@mainuddin-md mainuddin-md changed the title Add outlines documentation and link it in User Guide (issue #3484) DOC: Add outlines documentation and link it in User Guide Nov 9, 2025
@mainuddin-md
Copy link
Contributor Author

Hi @stefan6419846 ,

I have resolved the failing tests and moved the user docs to the user-specific directory.

Please review.

Copy link
Collaborator

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please align this new guide with the other ones which have changed to execute the actual example code in the meantime?

@mainuddin-md
Copy link
Contributor Author

Hi @stefan6419846,

Thanks for the feedback, I’ll align the new guide with the other ones that execute the actual example code and update the PR soon.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (310e571) to head (79b48dc).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3511      +/-   ##
==========================================
+ Coverage   97.16%   97.31%   +0.15%     
==========================================
  Files          57       55       -2     
  Lines        9809     9769      -40     
  Branches     1781     1780       -1     
==========================================
- Hits         9531     9507      -24     
+ Misses        167      155      -12     
+ Partials      111      107       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mainuddin-md mainuddin-md force-pushed the doc-outline-update branch 4 times, most recently from a7a0dcf to 29301f5 Compare November 26, 2025 19:06
@mainuddin-md
Copy link
Contributor Author

I have modified the PR to execute the actual code examples. Please review.

Copy link
Collaborator

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Judging from the structure etc., it seems like this is mostly auto-generated using AI - which is no issue as long as you have checked the changes yourself and it follows our usual structure.

Unfortunately, I cannot merge this as-is:

  • Could we please use subsections instead of separate files for reading and writing?
  • Why is the introduction a note in one case, but regular text in the other. I guess we should make this regular text.
  • The user docs are not for resembling the exact API and describing the parameters. These should go into the docstrings. If required, link to the corresponding methods/classes in your description using the corresponding Sphinx directive/role.
  • Please do not save arbitrary (and large) files in the resources directory. If you keep the order "Add" - "Read", you should be able to re-use the generated file in the second examples.
  • Do not import from internal modules like _fit. Use the public API only!
  • Instead of creating a reader and writer and adding the pages manually, just use writer = PdfWriter(clone_from="input.pdf").
  • The description of what the code does usually goes before it. This should be no list, but a short descriptive text.
  • If you decide to include screenshots, please make sure that they ideally resemble the input document and you have the necessary rights to include it. If highlighting is required, use proper drawing tools to get nice rectangles instead of arbitrary drawings.

Please note that I might have missed some aspects during this review due to merging this requires some larger changes anyway.

@stefan6419846 stefan6419846 linked an issue Dec 3, 2025 that may be closed by this pull request
@mainuddin-md
Copy link
Contributor Author

Hi @stefan6419846, I have incorporated the changes you suggested. requesting for review again. Thank you

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This file is rather large. Can we use a smaller one - or even one of the existing?
  • Do you own all the necessary copyrights to actually distribute this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reduced the pdf file size and I have all necessary copyrights because I had createad it by myself using google docs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not fully convinced why we cannot use one of the existing files? Especially since input.pdf is rather generic and we try to keep the changes to the resources directory as small as possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not fully convinced why we cannot use one of the existing files? Especially since input.pdf is rather generic and we try to keep the changes to the resources directory as small as possible.

@mainuddin-md
Copy link
Contributor Author

Hi @stefan6419846,

Thanks for the feedback. we need to upload output.pdf (a new pdf file which contains all the outlines) to the resources folder to ensure the reading tests pass. Since we are using a testoutput block to verify the outlines, the test runner needs a physical file to read from, which is why I included it.

Please review. Thank you

@stefan6419846
Copy link
Collaborator

Since we are using a testoutput block to verify the outlines, the test runner needs a physical file to read from, which is why I included it.

The process in the docs adds the outlines, thus reading the output from the previous step in the next step should still work, without having to add an output.pdf file to the repository explicitly?

@mainuddin-md
Copy link
Contributor Author

mainuddin-md commented Jan 6, 2026

Since we are using a testoutput block to verify the outlines, the test runner needs a physical file to read from, which is why I included it.

The process in the docs adds the outlines, thus reading the output from the previous step in the next step should still work, without having to add an output.pdf file to the repository explicitly?

Hi @stefan6419846,
I removed this output.pdf file and reading the output from the perivous steps.

However, to make the reading section work properly without overwriting, I'm saving each write code example section namely simple, nested and advanced in separate files namely simple-example.pdf , nested-example.pdf and advanced-example.pdf. Since, you gave the review comment to keep only one screenshot for all examples, the screenshot will not be completly in line with the code written to save output in different files.

Please review, Thank you.

Copy link
Collaborator

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience.

@stefan6419846 stefan6419846 merged commit f189f07 into py-pdf:main Jan 7, 2026
18 checks passed
@mainuddin-md mainuddin-md deleted the doc-outline-update branch January 7, 2026 11:21
stefan6419846 added a commit that referenced this pull request Jan 9, 2026
## What's new

### Security (SEC)
- Improve handling of partially broken PDF files (#3594) by @stefan6419846

### Deprecations (DEP)
- Block common page content modifications when assigned to reader (#3582) by @stefan6419846

### New Features (ENH)
- Embellishments to generated text appearance streams (#3571) by @PJBrs

### Bug Fixes (BUG)
- Do not consider multi-byte BOM-like sequences as BOMs (#3589) by @stefan6419846

### Robustness (ROB)
- Avoid empty FlateDecode outputs without warning (#3579) by @stefan6419846

### Documentation (DOC)
- Add outlines documentation and link it in User Guide (#3511) by @mainuddin-md

### Developer Experience (DEV)
- Add PyPy 3.11 to test matrix and benchmarks (#3574) by @rassie

### Maintenance (MAINT)
- Fix compatibility with Pillow >= 12.1.0 (#3590) by @stefan6419846

[Full Changelog](6.5.0...6.6.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document outline handling

2 participants