feat: optionally preserve page numbers when concatenating - #709
Open
ZhiyaoWen999 wants to merge 1 commit into
Open
feat: optionally preserve page numbers when concatenating#709ZhiyaoWen999 wants to merge 1 commit into
ZhiyaoWen999 wants to merge 1 commit into
Conversation
Signed-off-by: Zhiyao Wen <75983327+ZhiyaoWen999@users.noreply.github.com>
Contributor
|
✅ DCO Check Passed Thanks @ZhiyaoWen999, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
ZhiyaoWen999
marked this pull request as ready for review
August 4, 2026 09:51
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dolfim-ibm
requested changes
Aug 18, 2026
dolfim-ibm
left a comment
Member
There was a problem hiding this comment.
the PR looks good, but we want to hold until we do a full integration testing on the Docling CLI behavior and the Docling Serve API
the expected behavior is indeed, for example, that setting page_range=(10,20) will produce an output starting at page 10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
preserve_page_numbersargument toDoclingDocument.concatenate()PageItem.page_no, item provenance, and key-value/form graph-cell provenance when enabledMotivation
_DocIndex.index()always calculates a page offset that shifts every input document into a continuous sequence. This also shifts the first chunk when its original page range does not start at page 1, so callers processing PDF page ranges in parallel lose the source page numbers after concatenation.The new opt-in mode uses a zero page offset after checking that the input ranges do not overlap. Existing callers are unaffected.
Closes docling-project/docling#3890.
Validation