Skip to content

Commit

Permalink
fix readme section tags
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali committed Oct 14, 2020
1 parent 5e8b69f commit ff92782
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ work](https://github.com/sponsors/daattali) to unlock rewards\! ❤**
- [Similar packages](#similar)
- [Sponsors 🏆](#sponsors)

## How to use {#usage}
<h2 id="usage">How to use</h2>

Using {shinyscreenshot} is as easy as it gets. When you want to take a screenshot, simply call `screenshot()` and a full-page screenshot will be taken and downloaded as a PNG image. [Try it for yourself!](https://daattali.com/shiny/shinyscreenshot-demo/)

Expand All @@ -73,7 +73,7 @@ It's so simple that an example isn't needed, but here's one anyway:

shinyApp(ui, server)

## Features {#features}
<h2 id="features">Features</h2>

- **Region:** By default, the entire page is captured. If you'd like to capture a specific part of the screen, you can use the `selector` parameter to specify a CSS selector. For example, if you have a plot with ID `myplot` then you can use `screenshot(selector="#myplot")`.

Expand All @@ -85,11 +85,11 @@ It's so simple that an example isn't needed, but here's one anyway:

- **Module support:** As an alternative to the `selector` argument, you can also use the `id` argument. For example, instead of using `screenshot(selector="#myplot)"`, you could use `screenshot(id="myplot")`. The advantage with using an ID directly is that the `id` parameter is module-aware, so even if you're taking a screenshot inside a Shiny module, you don't need to worry about namespacing.

## Screenshot button {#screenshotbutton}
<h2 id="screenshotbutton">Screenshot button</h2>

The `screenshot()` function can be called any time inside the server portion of a Shiny app. A very common case is to take a screenshot after clicking a button. That case is so common that there's a function for it: `screenshotButton()`. It accepts all the same parameters as `screenshot()`, but instead of calling it in the server, you call it in the UI. It creates a button that, when clicked, will take a screenshot.

## Installation {#install}
<h2 id="install">Installation</h2>

To install the stable CRAN version:

Expand All @@ -100,23 +100,23 @@ To install the latest development version from GitHub:
install.packages("remotes")
remotes::install_github("daattali/shinyscreenshot")

## Motivation {#motivation}
<h2 id="motivation">Motivation</h2>

For years, I saw people asking online how can they take screenshots of the current state of a Shiny app. This question comes up especially with interactive outputs (plotly, timevis, maps, DT, etc). Some of these don't allow any way to save the current state as an image, and a few do have a "Save as image" option, but they only save the base/initial state of the output, rather than the current state after receiving user interaction.

After seeing many people asking about this, one day my R-friend Eric Nantz [asked about it as well](https://community.rstudio.com/t/taking-screenshots-within-a-shiny-app/6892), which gave me the motivation to come up with a solution.

## Browser support and limitations {#limitations}
<h2 id="limitations">Browser support and limitations</h2>

The screenshots are powered by the 'html2canvas' JavaScript library. They do not always produce perfect screenshots, please refer to 'html2canvas' for more information about the limitations.

The JavaScript libraries used in this package may not be supported by all browsers. {shinyscreenshot} should work on Chrome, Firefox, Edge, Chrome on Android, Safari on iPhone. It does not work in Internet Explorer.

## Similar packages {#similar}
<h2 id="similar">Similar packages</h2>

As mentioned above, the libraries used by {shinyscreenshot} do have limitations and may not always work. There are two other packages that came out recently that also provide screenshot functionality which you may try and compare: [snapper](https://github.com/yonicd/snapper) by Jonathan Cidi and [capture](https://github.com/dreamRs/capture) by dreamRs.

## Sponsors 🏆 {#sponsors}
<h2 id="sponsors">Sponsors 🏆</h2>

> There are no sponsors yet
Expand Down

0 comments on commit ff92782

Please sign in to comment.