Skip to content

kalinplus/pdf2pptx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf2pptx

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.

How to run

pdf2pptx slides.pdf                # auto-detect aspect ratio, default 1920px
pdf2pptx slides.pdf -r 3072        # custom resolution

The output file is slides.pptx in the same directory as the input PDF.

Install as a global command

Clone the repo first, then create a symlink:

macOS / Linux

git clone https://github.com/ashafaei/pdf2pptx.git
sudo ln -sf $(pwd)/pdf2pptx/pdf2pptx.sh /usr/local/bin/pdf2pptx

Or 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"

Windows (WSL / Ubuntu Bash on Windows 10/11)

git clone https://github.com/ashafaei/pdf2pptx.git
sudo ln -sf $(pwd)/pdf2pptx/pdf2pptx.sh /usr/local/bin/pdf2pptx

Windows (PowerShell without WSL)

git 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 Variables

Create pdf2pptx.cmd in the repo root with the following content:

@echo off
bash "%~dp0pdf2pptx.sh" %*

This requires Git Bash or WSL installed so that bash is available from CMD/PowerShell.

Dependencies

  • ImageMagickmagick (v7) or convert (v6)
  • zip, sed
  • bc (for aspect ratio calculation)
  • (Optional) perl, python, or ruby if you install via symlink

macOS (Homebrew)

brew install imagemagick

Ubuntu / Debian

sudo apt install imagemagick bc

Fedora / RHEL

sudo dnf install ImageMagick bc

Windows (WSL)

Same as Ubuntu — install inside the WSL distro.

ImageMagick PDF policy issue

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.

Acknowledgement

Thanks to Melissa O'Neill for providing a Pdf2Keynote tool for mac which has motivated this small project!

About

Convert your (Beamer) PDF slides to (Powerpoint) PPTX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%