Convert your (Beamer) PDF slides to (Powerpoint) PPTX
So you don't like using Powerpoint and would rather use Latex/Beamer to make your slides, however, you have a fancy Surface and you want to use the pen during the presentation? Here is my solution.
This script gets a PDF file as input and generates a Powerpoint PPTX file while preserving the format of the original PDF. Theoretically all PDF files, regardless of the original generator, can be converted to PPTX slides with this (not tested though).
Simply explained, I convert all the slides to high-quality image files first, and then push them into a Powerpoint project as a slide.
pdf2pptx slides.pdf # auto-detect aspect ratio, default 1920px
pdf2pptx slides.pdf -r 3072 # custom resolutionThe output file is slides.pptx in the same directory as the input PDF.
Clone the repo first, then create a symlink:
git clone https://github.com/ashafaei/pdf2pptx.git
sudo ln -sf $(pwd)/pdf2pptx/pdf2pptx.sh /usr/local/bin/pdf2pptxOr without sudo — put it in ~/.local/bin:
mkdir -p ~/.local/bin
ln -sf $(pwd)/pdf2pptx/pdf2pptx.sh ~/.local/bin/pdf2pptx
# Make sure ~/.local/bin is in your PATH (add to ~/.bashrc or ~/.zshrc):
# export PATH="$HOME/.local/bin:$PATH"git clone https://github.com/ashafaei/pdf2pptx.git
sudo ln -sf $(pwd)/pdf2pptx/pdf2pptx.sh /usr/local/bin/pdf2pptxgit clone https://github.com/ashafaei/pdf2pptx.git
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\bin\pdf2pptx.cmd" -Target "$PWD\pdf2pptx\pdf2pptx.cmd" -Force
# Add %USERPROFILE%\bin to your PATH via System Properties > Environment VariablesCreate pdf2pptx.cmd in the repo root with the following content:
@echo off
bash "%~dp0pdf2pptx.sh" %*This requires Git Bash or WSL installed so that
bashis available from CMD/PowerShell.
- ImageMagick —
magick(v7) orconvert(v6) zip,sedbc(for aspect ratio calculation)- (Optional)
perl,python, orrubyif you install via symlink
brew install imagemagicksudo apt install imagemagick bcsudo dnf install ImageMagick bcSame as Ubuntu — install inside the WSL distro.
ImageMagick may block PDF to image conversion by default. If you get an error like:
convert: not authorized `test.pdf' @ error/constitute.c/ReadImage/412.
Edit /etc/ImageMagick-7/policy.xml (or ImageMagick-6/policy.xml), change:
<policy domain="coder" rights="none" pattern="PDF" />to
<policy domain="coder" rights="read" pattern="PDF" />This requires root privileges.
Thanks to Melissa O'Neill for providing a Pdf2Keynote tool for mac which has motivated this small project!