Scrpit to convert your beautiful draw.io drawings into pdfs.
Project description
DrawIO2PDF
Intro
Always wondered how to make beautiful mathematical figures with latex inside them? You can use tikz but it's learning curve is steep and many only ascended people can use it fluently. How about draw.io? It allows you to make beautiful figures. What's better, you can latex-type there. But what is that? Have you tried to export it into PDF? No? I don't recommend that if you have a figure full of maths and you still want to have your eyes unharmed.
This is why I created this tool. You can export your figures from draw.io without worrying that it will break any math font. The output is essentially unrecognizable from a standard tikz figure. It will look beautiful in your PDF document and since it's a vector graphic, everyone can zoom in to take a deeper look into your diagram.
Requirements
- inkscape >= 1.0
- pdflatex (I use
sudo apt-get install texlive-full
for that) - python >= 3.6
Installation
From the pip repository:
pip install drawio2pdf
or from git:
pip install git+https://github.com/kacperkan/drawio2pdf/
Usage
- Create your beautiful diagram, using latex formulas and so on.
- Disable
Extras > Mathematical Typesetting
. - Export your diagram with SVG.
drawio2pdf <path-where-you-saved-your-svg>.
The script will a PDF in the same folder and the same file name.
The result:
FAQ
Q: I get AssertionError: Incorrect PDF latex generation
while running you script!
A: I met these issue personally in one of the following cases:
- I didn't have
pdflatex
orinkscape
that was runnable from the console - I accidentally put a new line in the math formula. When using
Mathematical Typesetting
, draw.io will render it correctly. However, the SVG file content will be completely broken and it's not that obvious how to parse it with theETree
in python. Solution: Remove any newline in mathematical formulas so they're one liners - I totally forgot to turn
Mathematical Typesetting
off.
Licence
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file drawio2pdf-0.0.0.tar.gz
.
File metadata
- Download URL: drawio2pdf-0.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a791076bebea708b3d22c3b29a33608ae66d9dbb4bd7a1379f828618ec9d0a97 |
|
MD5 | aa2ee226fdd1bdfbdb9c61f813d4b18d |
|
BLAKE2b-256 | d420ef22d6270a2620d3c614aa2d2d7e9d775016a51ccdc61c6ceada8f60a7d6 |
File details
Details for the file drawio2pdf-0.0.0-py3.8.egg
.
File metadata
- Download URL: drawio2pdf-0.0.0-py3.8.egg
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3033f99bf3283e6acd8021801afb52cbc2d3c94fcf9e691307ffc8ff2beec321 |
|
MD5 | cb3d6a6342795abd737422b184ddd920 |
|
BLAKE2b-256 | b38fdc14017f0ca400e13761e2c647dbeea0cd6ebc3110a15a77fa4db85f6636 |
File details
Details for the file drawio2pdf-0.0.0-py3.7.egg
.
File metadata
- Download URL: drawio2pdf-0.0.0-py3.7.egg
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffedfe35985df0d4eebe0dde0d49d1057fe939cdbf3590dceb7938c307cecc44 |
|
MD5 | 77785942efc230ae3726c715de05ba2e |
|
BLAKE2b-256 | dfc48a31915b2a9d3a8ce8b997e83029bf8b09fc6b83e5382571b18d5c09058e |
File details
Details for the file drawio2pdf-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: drawio2pdf-0.0.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea2c91719ae7fb594759148f661dfece17ab5c45d6e0d63bde466142f5fb2d10 |
|
MD5 | 196ab6d3f3b5394cf99f9ac4b4f2546e |
|
BLAKE2b-256 | aa03faedc6c1efb72846c3fbc94e3c11e3b86010f700f153f0edefedf907930a |