Program for converting SVG files to PPT
Tech Stack: Bash, LibreOffice Basic, MkDocs
January 2021 – present
Published: 10 March 2021
In early 2021 I found myself wanting to import lots of SVG files into Keynote. As someone who loves digital art and working with vectors, I didn’t want to settle for less (PDF, PNG). But the import process I found is a multi-step process with lots of clicking and prone to human error. It also involves working inside LibreOffice, something with which not everyone is comfortable or familiar.
Apple’s Keynote and Microsoft’s PowerPoint don’t have native support for SVG files. Instead they offer their own vector concept of “shapes.” A workaround is to convert the SVG into a PPT file (Microsoft PowerPoint 97-2003) as this can contain vectors and still be opened by these applications.
Prior to starting on this, I had recently purchased Alfred and begun experimenting and customizing its configuration to make sure I was getting my money’s worth. I had download some third-party workflows, but didn’t find any that blew me away.
One night when I was importing SVGs into Keynote a thought struck me: “This sucks and feels like it takes forever. Why can’t this be easier?” I had already begun implementing custom hotkeys to speed up the process, but even then it took some concentration not to mess one of the steps up.
Eventually I thought “Wait! Can I get Alfred to do this for me?” and then set out making a very long, proof-of-concept Alfred workflow. It relied on my hotkeys and had a ton of built-in wait time to accommodate for UI loading.
Once I got it working, I kept optimizing it and realized I could likely replace hotkey execution with some code. That’s what led me to LibreOffice macros and using their flavor of BASIC. The documentation was a little difficult to navigate through, but their community forums proved to be a great resource.
The most difficult part of the macro was trying to get it to read from a file which was the vehicle for passing in input. I got it working through much trial and error… only to find out later that there seems to be character limits on the view cursor I was using. So I ended up changing tactics and making the Bash script insert text into the macro. The trade-off here is that the macro is single-use, but it does seem to run faster and it’s easier to support & maintain that logic in Bash.
Speaking of Bash… at a certain point during optimizing the Alfred workflow I began to understand that everything I was doing in Alfred could be done in Bash. I didn’t have much previous experience using Bash, so it took a lot of reading and experimenting to replace everything.
Then something very bad happened. After a 6-hour work session resulting in my workflow being entirely replaced with Bash, I double clicked an old Alfred workflow file (
.alfredworkflow) to look at my previous work. Can you guess what happened? It installed the Alfred workflow… completely overwriting all the work I had done. I’m including this as a word of warning; the mantra “commit early, commit often” applies to all files, even ones that can’t be read through a text editor.
After this incident, though, I started fresh and did everything through Bash files. I recognize now that I should have been doing this previously, as this makes the code executable from the command-line (which everyone has) and a simple Alfred workflow. My journey learning Bash was a bit dizzying because I was learning Bash commands at the same time as how to structure it, debug it, and how to create versioned software that can be installed from a remote source (GitHub).
Version 1.0.0 is nearly complete now! Very proud to have gone from little to no Bash experience to a full-fledged program with changeable defaults and a super official domain to match: svgtoppt.com
The primary feature I think would add a lot of value is bulk conversion. I’m sure other areas for improvement will rear their head once development is in a good place and I can start using it regularly.
Related Projects by Others
Published in 2005 by David Astling, this program was able to convert SVG files directly into KEY files (
.key) which could be opened in Keynote and contained shapes. I say this based on the documentation and some videos I’ve seen online; I haven’t been able to get it to work on any of my Apple products.
Based on the error I receive I believe it was written for 32-bit execution, meaning it no longer works natively on modern versions of macOS. It’s also closed source which prevents someone like me from trying to uplift it. I contacted David in January 2021 about svg2key but haven’t yet received a response.
“Command line tools to convert Keynote slides to SVG”
“Keynote hates SVGs, convert SVGs to PNGs” 😂
I learned how to generalize an Alfred workflow into a Bash script with a dynamic Libre Office macro… then kick that process off through CLI or Alfred.