Last week I was too chill about the instructions for presenters at the XIV meeting of the Mexican Mammal Society. I brought my talk as a PDF even though they had requested PowerPoint files, and then this happened.
Here is an enhanced and annotated version of Clint’s photo.
Eventually I was able to show my slides because I had my talk on Google Slides and I could re-export it to PowerPoint. Another presenter scheduled for the same session also brought her slides as a PDF, but without her laptop she had no chance of re-exporting her talk. She asked me if there was some way of converting a PDF to a ppt before her slot came up, but I couldn’t (fortunately she was able to present from PDF without crashing the venue’s computer).
Going from PDF to anything else is not straightforward, but presentation slides shouldn’t be a problem because they are essentially just a series of images.
When I first searched (under pressure and with limited internet connectivity) for a way to convert PDFs to PowerPoint, all I found were shady web services, executable files, and this python script that I couldn’t run because I didn’t have all the necessary modules and I didn’t know how to install some of them.
The python script inspired me look for options using R, but I couldn’t find any so here’s my first attempt. This RMarkdown script can be knit into a pptx presentation, and the process is quite simple:
- convert each page in the PDF to an image using pdftools
- build paths for each image (C sprintf format strings are so useful!)
- iterate through the list of paths to create image tags (one image per slide)
- knit the file to PowerPoint
At this point, this is preliminary work but it should run OK in most situations. We need recent versions of RStudio and pandoc, and some kind of Office suite installed on our machines. *The content in the output pptx file will not be editable.**
The documentation says that images are scaled to fit the slides, but I couldn’t resize them and I’m not versed in css or in hardcoding the image dimensions so that they match the slide area. If you know how to fix this please let me know.
This is the overview of the pdf presentation I used in the example Rmd file, compared with the overview of the pptx output below. The pdf itself is available here.
The pptx version has the wider margins and a title slide that I did not suppress because I haven’t learned how to modify templates yet.
If you have any improvements for this workflow, please let me know or make edits on the Rmd file.