I am trying to convert xaringan slide to pdf file using the following code found in this page
---
title: "Lecture"
subtitle: "subtitle"
author: "Instructor"
institute: "University"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
seal: false
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
titleSlideClass: [top, left]
---
class: title-slide, top, left, inverse
background-image: url(aaa.jpeg)
background-size: cover
# *`r rmarkdown::metadata$title`*
## *`r rmarkdown::metadata$subtitle`*
### `r rmarkdown::metadata$author`
### `r rmarkdown::metadata$institute`
### `r rmarkdown::metadata$date`
### `r Sys.Date()`
```{css, echo=FALSE}
<style>
.remark-slide-content.hljs-default {
border-top: 40px solid #23373B;
}
.remark-slide-content > h1 {
font-size: 35px;
margin-top: -85px;
}
```
---
# Why people are constantly switching?
---
remotes::install_github('rstudio/pagedown')
pagedown::chrome_print('lecture_1.html')
```
But I got the following error message:
Error in force(expr) : Failed to generate output. Reason: Cannot navigate to invalid URL
My question is how to fix the issue and where is the more proper location of my command (can I put the code on the slide or should I put it on a separate window panel in Rstudio)?
You have to run this code pagedown::chrome_print('lecture_1.html')
from console (assuming your html file is in your working directory).
Also Note that here you are rendering the html output made from the r-markdown source file. But you can use your r-markdown file as input to chrome_print
like this,
pagedown::chrome_print("lecture_1.Rmd")