-
Notifications
You must be signed in to change notification settings - Fork 17
/
README.Rmd
76 lines (55 loc) · 2.42 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# webshot2
<!-- badges: start -->
[![R build status](https://github.com/rstudio/webshot2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/webshot2/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/webshot2)](https://CRAN.R-project.org/package=webshot2)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/webshot2?color=brightgreen)](https://www.r-pkg.org/pkg/webshot2)
[![RStudio community](https://img.shields.io/badge/community-webshot2-blue?style=social&logo=rstudio&logoColor=75AADB)](https://community.rstudio.com/new-topic?category=shiny&tags=webshot2)
<!-- badges: end -->
**webshot2** is meant to be a replacement for [webshot](https://wch.github.io/webshot/), except that instead of using PhantomJS, it uses headless Chrome via the [Chromote](https://github.com/rstudio/chromote) package.
## Installation
```R
# CRAN
install.packages("webshot2")
# Development
remotes::install_github("rstudio/webshot2")
```
You also need to have the Chrome browser installed on your system. You can also use other browsers based on Chromium, such as Chromium itself, Edge, Vivaldi, Brave, or Opera.
## Usage
``` r
library(webshot2)
# Single page
webshot("https://www.r-project.org")
```
<img src="man/figures/README-demo-1.png" width="100%" />
``` r
# Multiple pages (in parallel!)
webshot(c("https://www.r-project.org", "https://www.rstudio.com"))
```
<img src="man/figures/README-demo-2.png" width="100%" /><img src="man/figures/README-demo-3.png" width="100%" />
``` r
# Specific height and width
webshot("https://www.r-project.org", vwidth = 1600, vheight = 900, cliprect = "viewport")
```
<img src="man/figures/README-demo-4.png" width="100%" />
```{r demo-eval, eval = FALSE, echo = FALSE}
# Run this code to update the images above
library(webshot2)
# Single page
webshot("https://www.r-project.org", "man/figures/README-demo-1.png")
# Multiple pages (in parallel!)
webshot(c("https://www.r-project.org", "https://www.rstudio.com"), c("man/figures/README-demo-2.png", "man/figures/README-demo-3.png"))
# Specific height and width
webshot("https://www.r-project.org", "man/figures/README-demo-4.png", vwidth = 1600, vheight = 900, cliprect = "viewport")
```