SMOLNET PORTAL home about changes

Exporting draw.io images to LaTeX


DATE: 2020-07-22
AUTHOR: John L. Godlee


I discovered and tweaked a nifty one-liner which allows me to take .drawio files generated by Draw.io[1] and export them as clean vector-based .pdf files which I can then include in a LaTeX document:

1: https://app.diagrams.net/ (https://app.diagrams.net)


#!/usr/bin/env sh

find . -name *.drawio -exec rm -f ../img/{}.pdf \; -exec /Applications/draw.io.app/Contents/MacOS/./draw.io --crop -x -o ../img/{}.pdf {} \;


This finds all .drawio files in the current directory . and runs the draw.io executable on them to crop to the image and export as a .pdf to the directory where all my images are stored ../img/. \includegraphics{...} can then render the image in my LaTeX document. Note that this is on macOS, using the desktop version of draw.io, hence the funny executable.

Response: 20 (Success), text/gemini
Original URLgemini://republic.circumlunar.space/users/johngodlee/post...
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8