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
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
superdoc1.32.0https://cdn.jsdelivr.net/npm/superdoc/dist/superdoc.min.jsObserved behavior
When loading the attached DOCX in SuperDoc, pagination reports around
1985pages and the editor becomes unusable.Expected behavior
The document should paginate to approximately
43pages, 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:
Isolation results
I tested multiple DOCX variants to isolate the cause:
The minimal fix was changing only the first active word/footer2.xml anchor vertical offset from:
to:
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