Learn R Programming

pharmaRTF (version 0.1.4)

pagesize: Return or set pagesize

Description

These property functions modify or return the pagesize attribute of a rtf_doc object. Stored as a named vector with height and width names.

Usage

pagesize(x, ...)

pagesize(x) <- value

set_pagesize(x, value)

Arguments

x

A rtf_doc object

...

Additonal arguments passed to method dispatch

value

A named numeric vector with the names height and width.

Value

For pagesize(), the pagesize attribute of the rtf_doc object. For `pagesize<-`() and set_pagesize(), the modified object.

Details

Note that when the orientation of the document is switched to 'portrait', the height and width will reverse when the RTF document is being written - but the attribute values will not change. This is because the default rtf_doc orientation is 'landscape', and switching the attributes of the object allows for a possibility of inadvertently overriding the functionality of the orientation attribute.

Examples

Run this code
# NOT RUN {
library(huxtable)
ht <- huxtable(
  column1 = 1:5,
  column2 = letters[1:5]
)
rtf <- rtf_doc(ht, list(hf_line("aTitle")))

pagesize(rtf)
# Returns c(height = 8.5, width = 11.0)

pagesize(rtf) <- c(height = 12)
# Sets height of page to 12 inches

orientation(rtf) <- 'portrait'
pagesize(rtf)
#  width height
#    8.5   12.0
# Note: Despite changing orientation, attributes don't change

# }

Run the code above in your browser using DataLab