gtsave_extra: Use webshot2 to save a gt table as a PNG

View source: R/gtsave_extra.R

gtsave_extraR Documentation

Use webshot2 to save a gt table as a PNG

Description

Takes existing HTML content, typically additional HTML including a gt table as a PNG via the {webshot2} package.

Usage

gtsave_extra(data, filename, path = NULL, ..., zoom = 2, expand = 5)

Arguments

data

HTML content to be saved temporarily to disk

filename

The name of the file, should end in .png

path

An optional path

...

Additional arguments to webshot2::webshot()

zoom

A number specifying the zoom factor. A zoom factor of 2 will result in twice as many pixels vertically and horizontally. Note that using 2 is not exactly the same as taking a screenshot on a HiDPI (Retina) device: it is like increasing the zoom to 200 doubling the height and width of the browser window.

expand

A numeric vector specifying how many pixels to expand the clipping rectangle by. If one number, the rectangle will be expanded by that many pixels on all sides. If four numbers, they specify the top, right, bottom, and left, in that order.

Value

Prints the HTML content to the RStudio viewer and saves a .png file to disk

Function ID

2-14

See Also

Other Utilities: add_text_img(), fa_icon_repeat(), fmt_pad_num(), fmt_pct_extra(), fmt_symbol_first(), generate_df(), gt_add_divider(), gt_badge(), gt_double_table(), gt_duplicate_column(), gt_fa_column(), gt_fa_rank_change(), gt_fa_rating(), gt_fa_repeats(), gt_highlight_cols(), gt_highlight_rows(), gt_img_border(), gt_img_circle(), gt_img_multi_rows(), gt_img_rows(), gt_index(), gt_merge_stack_color(), gt_merge_stack(), gt_two_column_layout(), img_header(), pad_fn(), tab_style_by_grp()


gtExtras documentation built on Sept. 16, 2023, 1:08 a.m.