1

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)?

2
  • Add a code of your slide Commented Aug 27, 2022 at 20:53
  • I just updated my code. Commented Aug 27, 2022 at 21:42

1 Answer 1

1

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") 
Sign up to request clarification or add additional context in comments.

1 Comment

The thing is I need to properly add main directory and subdirectories before the file name. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.