Render slides as a PDF file. Requires a local installation of Chrome.
If you set complex_slides = TRUE
or partial_slides = TRUE
, you will also
need to install the chromote and pdftools packages.
Usage
to_pdf(
from,
to = NULL,
complex_slides = FALSE,
partial_slides = FALSE,
delay = 1,
keep_intermediates = NULL
)
Arguments
- from
Path to an
.Rmd
,.qmd
,.html
file, or a URL. Iffrom
is a URL to slides on a website, you must provide the full URL ending in".html"
.- to
The name of the output
.pdf
file. IfNULL
(the default) then the output filename will be based on filename for thefrom
file. If a filename is provided, a path to the output file can also be provided.- complex_slides
For "complex" slides (e.g. slides with panelsets or other html widgets or advanced features), set
complex_slides = TRUE
. Defaults toFALSE
. This will use the chromote package to iterate through the slides at a pace set by thedelay
argument. Requires a local installation of Chrome.- partial_slides
Should partial (continuation) slides be included in the output? If
FALSE
, the default, only the complete slide is included in the PDF.- delay
Seconds of delay between advancing to and printing a new slide. Only used if
complex_slides = TRUE
orpartial_slides = TRUE
.- keep_intermediates
Should we keep the intermediate HTML file? Only relevant if the
from
file is an.Rmd
file. Default isTRUE
if theto
file is written into the same directory as thefrom
argument, otherwise the intermediate file isn't kept.
Examples
with_example("slides.Rmd", requires_chrome = TRUE, {
# Render pdf from Rmd, html, or direct URL
to_pdf("slides.Rmd")
})
#> ℹ Rendering slides.Rmd into slides.html
#> ✔ Rendering slides.Rmd into slides.html ... done
#>
#> ℹ Rendering slides.html into slides.pdf
#> ✔ Rendering slides.html into slides.pdf ... done
#>