Render slides as a .pptx file. The function renders to the PDF and
then converts it into PNG images that are inserted on each slide in the
PowerPoint file.
Usage
to_pptx(
from,
to = NULL,
density = 100,
slides = "all",
complex_slides = FALSE,
partial_slides = FALSE,
delay = 1,
keep_intermediates = FALSE,
ratio = NULL
)Arguments
- from
Path to an
.Rmd,.qmd,.html,.pdffile, or a URL. Iffromis a URL to slides on a website, you must provide the full URL ending in".html".- to
Name of the output
.pptxfile.- density
Resolution of the resulting PNGs in each slide file. Defaults to
100.- slides
A numeric or integer vector of the slide number(s) to include in the pptx, or one of
"all","first", or"last". Negative integers select which slides not to include. Defaults to"all", in which case all slides are included.- 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 thedelayargument. 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 = TRUEorpartial_slides = TRUE.- keep_intermediates
Should we keep the intermediate files used to render the final output? The default is
FALSE.- ratio
PowerPoint slides ratio. Possible values are
"4:3","16:9". Default toNULL, meaning it will be guessed frm the slides.
Examples
with_example("slides.Rmd", requires_chrome = TRUE, requires_packages = "officer", {
# Render pptx from Rmd, html, pdf, or direct URL
to_pptx("slides.Rmd")
})
#> ℹ Rendering slides.Rmd into renderthis_3a1b482bf95.html
#> ✔ Rendering slides.Rmd into renderthis_3a1b482bf95.html ... done
#>
#> ℹ Rendering renderthis_3a1b482bf95.html into renderthis_3a1b3d241d75.pdf
#> ✔ Rendering renderthis_3a1b482bf95.html into renderthis_3a1b3d241d75.pdf ... do…
#>
#> ℹ Removed temporary renderthis_3a1b482bf95.html
#> ℹ Rendering renderthis_3a1b3d241d75.pdf into slides.pptx
#> ✔ Rendering renderthis_3a1b3d241d75.pdf into slides.pptx ... done
#>
#> ℹ Removed temporary renderthis_3a1b3d241d75.pdf
