Skip to contents

Returns the page's rotation as 0, 90, 180, or 270 degrees. PDFium reports the rotation stored in the page's /Rotate entry combined with any runtime rotation applied via the editing API.

Usage

pdf_page_rotation(page, page_num = 1L)

Arguments

page

A pdfium_page from pdf_page_load(), or a pdfium_doc.

page_num

One-based page index. Only used when page is a pdfium_doc. Ignored otherwise.

Value

An integer in {0, 90, 180, 270}.

Details

A non-zero rotation means pdf_page_size()'s width and height refer to the page's pre-rotation media box, not the on-screen dimensions a viewer would display. For an "as-displayed" size, swap width and height when rotation is 90 or 270.

See also

pdf_page_size() for the un-rotated dimensions.

Examples

fixture <- system.file("extdata", "fixtures", "minimal.pdf",
  package = "pdfium"
)
if (nzchar(fixture)) {
  doc <- pdf_doc_open(fixture)
  pdf_page_rotation(doc, 1)
  pdf_doc_close(doc)
}