| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/browser.R |
| 3 |
\name{browser_print} |
| 4 |
\alias{browser_print} |
| 5 |
\title{Print a web page to PDF/PNG/JPEG} |
| 6 |
\usage{ |
| 7 |
browser_print( |
| 8 |
input, |
| 9 |
output = ".pdf", |
| 10 |
args = "default", |
| 11 |
window_size = c(1280, 1024), |
| 12 |
browser = NULL |
| 13 |
) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{input}{Path or URL to the HTML page to be printed.} |
| 17 |
|
| 18 |
\item{output}{An output filename. If only an extension is provided, the |
| 19 |
filename will be inferred from \code{url} via \code{\link[=url_filename]{url_filename()}}. Only \code{.pdf}, |
| 20 |
\code{.png}, and \code{.jpeg} are supported.} |
| 21 |
|
| 22 |
\item{args}{Command-line arguments to be passed to the headless browser. The |
| 23 |
default arguments can be found in \code{xfun:::browser_args()}. You may pass |
| 24 |
additional arguments on top of these via, e.g., \code{c('default', '--no-pdf-header-footer')}, or completely override the default arguments by |
| 25 |
providing a vector of other arguments.} |
| 26 |
|
| 27 |
\item{window_size}{The browser window size when taking a PNG/JPEG screenshot. |
| 28 |
Ignored when printing to PDF.} |
| 29 |
|
| 30 |
\item{browser}{Path to the web browser. By default, the browser is found via |
| 31 |
\code{xfun:::find_browser()}. If it cannot be found, you may set the global |
| 32 |
option \code{options(xfun.browser = )} or environment variable \code{R_XFUN_BROWSER} |
| 33 |
to the path of the browser, or simply pass the path to the \code{browser} |
| 34 |
argument.} |
| 35 |
} |
| 36 |
\value{ |
| 37 |
The \code{output} path if the web page is successfully printed. |
| 38 |
} |
| 39 |
\description{ |
| 40 |
Print a web page to PDF or take a screenshot to PNG/JPEG via a headless |
| 41 |
browser such as Chromium or Google Chrome. |
| 42 |
} |
| 43 |
\examples{\dontshow{if (interactive()) \{} |
| 44 |
xfun::browser_print("https://www.r-project.org") |
| 45 |
\dontshow{\}} |
| 46 |
} |