pagesize: Return or set pagesize

Description Usage Arguments Details Value Examples

View source: R/properties.R

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

1
2
3
4
5
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.

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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

pharmaRTF documentation built on Sept. 28, 2021, 5:08 p.m.