Repository navigation
Footer wp:anchor vertical offset is treated as body height during pagination #3256
Description
What happened?
Bug: DOCX with anchored footer shape paginates as ~1985 pages instead of 43
Summary
SuperDoc appears to misinterpret a floating anchored object in a DOCX footer as document body height, causing pagination to explode from ~43 pages to ~1985 pages.
The same DOCX opens normally in Microsoft Word and reports 43 pages in the DOCX metadata.
Environment
- Package:
superdoc - Version:
1.32.0 - Usage: CDN build
- URL used:
https://cdn.jsdelivr.net/npm/superdoc/dist/superdoc.min.js - Browser: Chrome / Chromium
- Mode: paginated SuperDoc editor
Observed behavior
When loading the attached DOCX in SuperDoc, pagination reports around 1985 pages and the editor becomes unusable.
Expected behavior
The document should paginate to approximately 43 pages, matching Microsoft Word / DOCX metadata.
Minimal finding
The issue appears to be triggered by a floating anchored footer object in:
word/footer2.xml
Specifically this vertical anchor offset:
<wp:positionV relativeFrom="paragraph">
wp:posOffset10223818</wp:posOffset>
</wp:positionV>
This object is inside an mc:AlternateContent block in the footer and represents a footer confidentiality label / shape.
Microsoft Word handles this as a footer-positioned floating object. SuperDoc appears to include the large vertical offset in document layout/pagination height, causing the huge page count.
Reproduction
Load the attached DOCX with:
new SuperDoc({
selector: "#editor",
document: file,
documentMode: "editing",
role: "editor",
comments: { visible: true },
modules: {
trackChanges: {
enabled: true,
mode: "review",
replacements: "independent",
visible: true,
},
},
});
Isolation results
I tested multiple DOCX variants to isolate the cause:
- Removing embedded fonts: still broken
- Removing custom XML: still broken
- Removing comments: loads normally
- Removing content controls: loads normally
- Accepting tracked revisions: loads normally
- Removing footnotes/endnotes: loads normally
- Normalizing only word/footer2.xml: loads normally
- Normalizing other header/footer files individually: still broken
- Setting only the horizontal footer anchor offset to 0: still broken
- Setting the vertical footer anchor offset to 0: fixed
- Setting the vertical footer anchor offset to 720 or -720: fixed
The minimal fix was changing only the first active word/footer2.xml anchor vertical offset from:
<wp:posOffset>10223818</wp:posOffset>
to:
<wp:posOffset>0</wp:posOffset>
After that, SuperDoc reports 43 pages.
Expected handling
SuperDoc should not let a footer wp:anchor vertical offset inflate body pagination. Footer/header anchored objects should be constrained to the header/footer layout context, matching Word behavior.
Steps to reproduce
No response
SuperDoc version
No response
Browser
None
Additional context
No response
Activity
linear commentedon May 12, 2026
IT-1045
vivienne-sd commentedon May 19, 2026
Hi @MohitTilwani15 I was able to reproduce the pagination issue on a net new document, based on the info you shared. We're working on fixing it!
You mentioned an attached .docx, but I didn't see it here. Do you mind sharing that? We'll confirm our fix against your specific document as well.
I'll follow up here by next Tuesday (05/19) with an update on our work.
vivienne-sd commentedon May 20, 2026
Hi @MohitTilwani15, we've got a broad er project for graphic handling set to kick off on 05/25 which will include the necessary work to address the pagination issue in this document. That works spans June, so I will keep you in the loop as we make progress there and update you as the exact issue you ran into is resolved. if you have the .docx you mentioned, please still feel free to send it: I'll test it against our fix as soon as it's in place.
1 remaining item
ohcedar commentedon Jul 15, 2026
We hit the same underlying issue in
@harbour-enterprises/superdoc@1.44.1with a different DOCX. In our case the default footer contained a floatingwp:anchorwithwrapSquareand a large paragraph-relative verticalwp:posOffset. Word rendered the document normally, but SuperDoc let that absolute footer position inflate the measured footer story height, consuming the body pagination area.The critical part of our downstream patch is in
isHeaderFooterAbsoluteOverlay:function isHeaderFooterAbsoluteOverlay(block, kind, fragment, fragmentBottom, canvasHeight) { if (!kind) return false; if (block.anchor?.isAnchored !== true) return false; - if (block.wrap?.type !== "None") return false; return fragment.y < 0 || fragmentBottom > canvasHeight; }The
wrap.type !== "None"guard was the key problem. It meant an anchored header/footer object outside its story canvas was treated as contributing to header/footer story height whenever it usedwrapSquare(or another wrapping mode), even though its position is an absolute overlay in that story.This remains narrowly scoped:
kindmust identify a header/footer story;Normal body objects and in-bounds wrapped header/footer objects are unchanged.
Our isolation checks also supported this exact path: removing only the affected footer drawing fixed pagination; changing
wrapSquaretowrapNonefixed it; and settingbehindDoc="1"fixed it. With the patch, the original document rendered body content on all expected pages while retaining the footer object. We also verified the patch applies cleanly to a fresh 1.44.1 package and passes our full application test/build suite.caio-pizzol commentedon Sep 11, 2026
@MohitTilwani15 @ohcedar sorry for the long gap since our last update. We confirmed that the wrapped-footer case still affects V2: in our controlled example, the large footer offset increases the page count from 43 to 171. Removing wrapping or resetting the offset restores 43 pages. We’ve added these findings to the V2 engineering ticket. Your patch details were helpful, though we haven’t verified that patch as a V2 fix. We’ll keep this issue open and follow up when we have an update.
ohcedar commentedon Oct 30, 2026
Still reproduces in SuperDoc 2.28.0 (jsDelivr CDN build, Chrome), so this is still hitting us on real documents.
A file-free repro: run this Python 3 script, then open each generated DOCX in SuperDoc. Both contain 60 body paragraphs and a footer image using
wp:anchor,wrapSquare, and paragraph-relative vertical positioning. The only difference iswp:posOffset:0versus8458835EMU.Expected: the footer drawing's large vertical offset should not consume almost the entire body area. Word for Mac renders both files as four pages.
Actual:
footer-offset-zero.docxfooter-offset-far.docxThe footer box grows from 48 px to 934 px on a 1056 px page, leaving one body line per page.