From the course: Creating Reports and Presentations with R Markdown and RStudio

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

htmlwidgets in PDF .Rmd documents

htmlwidgets in PDF .Rmd documents - RStudio Tutorial

From the course: Creating Reports and Presentations with R Markdown and RStudio

Start my 1-month free trial

htmlwidgets in PDF .Rmd documents

- [Instructor] If you want to insert HTML widgets into PDF documents created with R Markdown you need Webshot. Webshot is an R package that allows R to programmatically take screenshots. It depends on PhantomJS but it's extremely simple to install PhantomJS from within Webshot package. Once you've setup Webshot when you create a PDF from R Markdown your HTML Widgets will be automatically converted into static images. There are three steps to screenshot perfection. First deactivate animation in your chart. Nine times out of ten deactivating animation will give you a good enough static image in your PDF reports. If this doesn't give you what you need you can use the Webshot package to programmatically take screenshots yourself and then use insert graphics to insert these images into your PDF. If you can't get what you need with with Webshot package I recommend not investing too much time trying to get what you want and instead take a manual screenshot and insert that into your PDF with…

Contents