pagedown: Creating beautiful PDFs with R Markdown and CSS - Yihui Xie

The traditional way to beautiful PDFs is often through LaTeX or Word, but have you ever thought of printing a web page to PDF? Web technologies (HTML/CSS/JavaScript) are becoming more and more amazing. It is entirely possible to create high-quality PDFs through Google Chrome or Chromium now. Web pages are usually single-page documents, but they can be paginated thanks to the JavaScript library Paged.js, so that you can have elements like headers, footers, and page margins for the printing purpose. In this talk, we introduce a new R package, pagedown (, to create PDF documents based on R Markdown and Paged.js. Applications of pagedown includes, but not limited to, books, articles, posters, resumes, letters, and business cards. With the power of CSS and JavaScript, you can typeset your documents with amazing elegance (e.g., a single line of CSS, "tr:nth-child(even) { background: #eee; }", will give you a striped table, and "border-radius: 50%;" gives you a circular element) and power (e.g., HTML Widgets).

About the Author

Yihui Xie

Yihui Xie is a software engineer at RStudio. He earned his PhD from the Department of Statistics, Iowa State University. He is interested in interactive statistical graphics and statistical computing. As an active R user, he has authored several R packages, such as knitr, bookdown, blogdown, xaringan, animation, DT, tinytex, tufte, formatR, fun, mime, highr, servr, and Rd2roxygen, among which the animation package won the 2009 John M. Chambers Statistical Software Award (ASA). He also co-authored a few other R packages, including shiny, rmarkdown, and leaflet. He has published a number of books, including “Dynamic Documents with R and knitr”, “bookdown: Authoring Books and Technical Documents with R Markdown”, “blogdown: Creating Websites with R Markdown”, and “R Markdown: The Definitive Guide”.

Follow on Twitter More Content by Yihui Xie
Previous Video
Using R, the Tidyverse, H2O, and Shiny to reduce employee attrition - Matt Dancho
Using R, the Tidyverse, H2O, and Shiny to reduce employee attrition - Matt Dancho

An organization that loses 200 high-performing employees per year has a lost productivity cost of about $15...

Next Video
Explicit Direct Instruction in Programming Education - Felienne
Explicit Direct Instruction in Programming Education - Felienne

In education, there is and has always been debate about how to teach. One of these debates centers around t...