| browser_print | R Documentation |
Print a web page to PDF or take a screenshot to PNG/JPEG via a headless browser such as Chromium or Google Chrome.
browser_print(
input,
output = ".pdf",
args = "default",
window_size = c(1280, 1024),
browser = NULL,
query = NULL,
wait = NULL,
timeout = 60
)
input |
Path or URL to the HTML page to be printed. |
output |
An output filename. If only an extension is provided, the
filename will be inferred from |
args |
Command-line arguments to be passed to the headless browser. The
default arguments can be found in |
window_size |
The browser window size when taking a PNG/JPEG screenshot. Ignored when printing to PDF. |
browser |
Path to the web browser. By default, the browser is found via
|
query |
A named list (or vector) of query parameters to be appended to
the URL of the page, e.g., |
wait |
A JavaScript expression that must be true before the page is
printed (or its DOM is dumped), e.g., |
timeout |
The maximum number of seconds to wait for the browser and the
page (when |
The output path if the web page is successfully printed.
xfun::browser_print("https://www.r-project.org")
# wait for a condition, or an event, on the page
# xfun::browser_print("index.html", wait = "window.pageReady")
# xfun::browser_print("index.html", wait = c(event = "pageReady"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.