The PDF output is based on the ASCII output created with toString()
Usage
export_as_pdf(
x,
file,
page_type = "letter",
landscape = FALSE,
pg_width = page_dim(page_type)[if (landscape) 2 else 1],
pg_height = page_dim(page_type)[if (landscape) 1 else 2],
width = NULL,
height = NULL,
margins = c(4, 4, 4, 4),
min_siblings = 2,
font_family = "Courier",
font_size = 8,
fontsize = font_size,
paginate = TRUE,
lpp = NULL,
cpp = NULL,
hsep = "-",
indent_size = 2,
tf_wrap = TRUE,
max_width = NULL,
colwidths = propose_column_widths(x)
)
Arguments
- x
ANY. The table-like object to export. Must have an applicable
matrix_form
method.- file
file to write, must have
.pdf
extension- page_type
character(1). Name of a page type. See
page_types
. Ignored whenpg_width
andpg_height
are set directly.- landscape
logical(1). Should the dimensions of
page_type
be inverted for landscape? Defaults toFALSE
, ignored whenpg_width
andpg_height
are set directly.- pg_width
numeric(1). Page width in inches.
- pg_height
numeric(1). Page height in inches.
- width
Deprecated, please use
pg_width
or specifypage_type
. The width of the graphics region in inches- height
Deprecated, please use
pg_height
or specifypage_type
. The height of the graphics region in inches- margins
numeric(4). The number of lines/characters of margin on the bottom, left, top, and right sides of the page.
- min_siblings
numeric. Minimum sibling rows which must appear on either side of pagination row for a mid-subtable split to be valid. Defaults to 2.
- font_family
character(1). Name of a font family. An error will be thrown if the family named is not monospaced. Defaults to Courier.
- font_size
numeric(1). Font size, defaults to 12.
- fontsize
Deprecated, please use
font_size
. The size of text (in points)- paginate
logical(1). Whether pagination should be performed, defaults to
TRUE
if page size is specified (including the default).- lpp
numeric(1) or NULL. Lines per page. if NA (the default, this is calculated automatically based on the specified page size).
NULL
indicates no vertical pagination should occur.- cpp
numeric(1) or NULL. Width in characters per page. if NA (the default, this is calculated automatically based on the specified page size).
NULL
indicates no horizontal pagination should occur.- hsep
character(1). Characters to repeat to create header/body separator line. If
NULL
, the object value will be used. If" "
, an empty separator will be printed. Checkdefault_hsep()
for more information.- indent_size
numeric(1). Indent size in characters. Ignored when
x
is already aMatrixPrintForm
object in favor of information there.- tf_wrap
logical(1). Should the texts for title, subtitle, and footnotes be wrapped?
- max_width
integer(1), character(1) or
NULL
. Width that title and footer (including footnotes) materials should be word-wrapped to. IfNULL
, it is set to the current print width of the session (getOption("width")
). If set to"auto"
, the width of the table (plus any table inset) is used. Ignored completely iftf_wrap
isFALSE
.- colwidths
numeric vector. Column widths (in characters) for use with vertical pagination.
Details
By default, pagination is performed with default
cpp
and lpp
defined by specified page dimensions and margins.
User-specified lpp
and cpp
values override this, and should
be used with caution.
Title and footer materials are also word-wrapped by default
(unlike when printed to the terminal), with cpp
, as
defined above, as the default max_width
.
Examples
if (FALSE) {
tf <- tempfile(fileext = ".pdf")
export_as_pdf(basic_matrix_form(mtcars), file = tf, pg_height = 4)
tf <- tempfile(fileext = ".pdf")
export_as_pdf(basic_matrix_form(mtcars), file = tf, lpp = 8)
}