Convert quarto revealjs slides to pdf
Without losing styles and formatting
A few days ago, I needed to create slides for a PyCon talk I’ll be giving on May 16 in Long Beach, California. Since I was going to be showing a lot of code in my talk, I didn’t want to use PowerPoint to create the slides because that would have been too tedious. Instead, I opted for Quarto, a publishing system that is particularly suitable for scientific and technical writing. I’m already familiar with Quarto because I use it to write all my blog content, so using it to create slides didn’t require much learning. However, there was one problem.
Submitting the slides to pycon
The RevealJS slides I created with Quarto looked beautiful when rendered as HTML, but PyCon required me to submit either a PDF or PPTX file. Although I liked the HTML output and planned to use it during the actual talk, I still needed to convert the slides into an acceptable submission format.
Quarto can export to multiple formats, so I first tried converting my slides.qmd file to a pptx file. However, the output wasn’t nearly as aesthetically pleasing as the original HTML version. I then tried exporting the slides to a pdf file, but the result looked even worse. I needed to find a better way to create the required file formats.
The solution that worked
Unhappy with the appearance of the PDF and PPTX files generated by Quarto, I almost resorted to recreating the slides from scratch in Microsoft PowerPoint. Still, I wasn’t enthusiastic about doing that. I had a strong feeling there had to be a better solution.
While searching for alternatives, I tried rendering the slides in the browser and using the browser’s “Print to PDF” option. Again, the downloaded PDF slides left much to be desired. The whole process felt impossible until I discovered DeckTape, a high-quality PDF exporter for HTML presentation frameworks.
Desperate to solve my problem, I installed DeckTape globally with the following command:
npm install -g decktapeI then used it to convert my rendered Quarto slides into a PDF:
decktape http://localhost:4407/blog/pycon-usa/#/title-slide pycon_slides.pdfThe structure of the command can be broken down as follows:
decktape <URL to your Quarto RevealJS slides> <name_of_output_file>.pdfThe generated PDF slides looked exactly the same as the rendered HTML slides. DeckTape will definitely be my go-to tool for creating PDF slides as I make speaking a regular part of my career.