Function: removeRotation()
function removeRotation(doc, page): number;Defined in: src/helpers/layout/pageRotation.ts:61
Strip rotation from a page while preserving its visual appearance, then return the previous rotation value.
Faithful port of PyMuPDF's page.remove_rotation(): clearing the /Rotate entry alone leaves text and vector content in the page's raw (authoring) orientation, which transposes rows/columns of any table on a 90°/270° page. Instead we prepend a derotation matrix to the content stream and map the page boxes (MediaBox, CropBox, ...) through it, so downstream extraction sees coordinates in the visually-correct (display) frame — matching upstream pymupdf4llm, which calls remove_rotation() on every page.
The caller must reload the page afterwards (doc.loadPage) for the new page bounds to take effect.
Parameters
doc
PDFDocument
page
PDFPage
Returns
number