grob_to_pdf: Grob Layout to PDF

Description Usage Arguments Details Value Examples

View source: R/grob_to_pdf.R

Description

Converts a single grob-layout to a PDF, or combines multiple grob-layouts into a multiple page PDF document.

Usage

1
2
3
4
5
6
grob_to_pdf(
  ...,
  file_name = character(),
  add_page_numbers = FALSE,
  meta_data_title = character()
)

Arguments

...

The single grob_layout, or series of grob_layout's which will be converted to a PDF document.

file_name

The desired file name of the resulting PDF document in character format.

add_page_numbers

If TRUE, page numbers will be added to the bottom right corners of the pages of the document, based on the order of the grob-layouts listed.

meta_data_title

Title string to embed as the /Title field in the file. If not provided, it will default to the file_name provided.

Details

In the case of multiple page documents, the dimensions of the overall document will be determined by the dimensions of the first grob-layout listed.

Value

A PDF document of the grob-layout(s) which will be saved to the working directory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
grob_layout(
  grob_row(
    grob_col(1, border = TRUE),
    grob_col(2, border = TRUE),
    border = TRUE
    ),
  grob_row(
    grob_col(3, border = TRUE),
    grob_col(
      grob_row(grob_col(4, border = TRUE), border = TRUE),
      grob_row(grob_col(5, border = TRUE), border = TRUE),
      border = TRUE
      ),
    border = TRUE
    )
  ) %>%
  grob_to_pdf(
    file_name = file.path(tempdir(), "test.pdf"),
    meta_data_title = "Test PDF"
    )

grobblR documentation built on Sept. 15, 2021, 1:07 a.m.