I learned how to insert a certain page of pdf file on my xaringan slide using the following code:
```
{r}
magick::image_read_pdf("document.pdf", pages = 1)
```
The problem is I still cannot see the item on the page because it is located in down below. So I wonder if there's any function like leaflet
so that I may be able to scroll the pdf document down.
You can try embed a pdf file using embed
html tag, like this,
---
title: "Adding scrollable pdf file in xaringan"
output: xaringan::moon_reader
---
```{css, echo=FALSE}
#embeded_pdf {
width: 100%;
height: 70%;
}
```
## Adding a pdf file
<embed src="lorem_ipsum.pdf" type="application/pdf" id="embeded_pdf">
Note that,
Open the output html file (xaringan slide) in your browser, Rstudio does not show the embedded files in xaringan slides; but in browser, it works fine.
And in src
option of embed
tag, provide the file path of the pdf file that you want to embed.