Skip to main content

A Python library for parsing Microsoft Visio files (.vsdx, .vsd) — native support for both XML and binary formats

Project description

libvisio-ng

CI PyPI Python Documentation License

A Python library for parsing and converting Microsoft Visio files to SVG.

Native support for both .vsdx (XML) and .vsd (binary) formats — no external C++ dependencies required.

Features

  • Native .vsdx parsing — zero external dependencies for XML-based Visio formats
  • Native .vsd parsing — binary OLE2 format support via olefile (no libvisio/C++ needed)
  • Theme support — resolves Visio themes, gradients, and shadows
  • Text extraction — extract all text content from diagrams
  • Page metadata — enumerate pages with dimensions and names
  • SVG output — high-fidelity SVG conversion with geometry, text, and styling
  • CLI toolvisio2svg command for quick conversions
  • PNG/PDF export — optional CairoSVG-based rasterization

Installation

pip install libvisio-ng

For PNG/PDF export support:

pip install libvisio-ng[png]

Quick Start

from libvisio_ng import convert, get_page_info, extract_text

# Convert all pages to SVG (works with both .vsdx and .vsd)
svg_files = convert("diagram.vsdx", output_dir="output/")
svg_files = convert("legacy.vsd", output_dir="output/")

# Get page information
for page in get_page_info("diagram.vsdx"):
    print(f"{page['name']}: {page['width']}x{page['height']}")

# Extract text
text = extract_text("diagram.vsdx")

Working with .vsd binary files directly

from libvisio_ng._vsd_parser import parse_vsd_file

doc = parse_vsd_file("legacy.vsd")
for page in doc.pages:
    print(f"Page: {page.name} ({page.width}x{page.height} inches)")
    for shape in page.shapes:
        if shape.text:
            print(f"  Shape {shape.shape_id}: {shape.text}")
        print(f"    Position: ({shape.xform.pin_x}, {shape.xform.pin_y})")
        print(f"    Size: {shape.xform.width}x{shape.xform.height}")

CLI

# Convert to SVG
visio2svg convert diagram.vsdx -o output/
visio2svg convert legacy.vsd -o output/

# Show page info
visio2svg info diagram.vsdx

# Extract text
visio2svg text diagram.vsdx

Supported Formats

Format Extension Support
Visio Drawing (XML) .vsdx, .vsdm ✅ Native
Visio Template (XML) .vstx, .vstm ✅ Native
Visio Stencil (XML) .vssx, .vssm ✅ Native
Visio Drawing (Binary) .vsd ✅ Native (olefile)
Visio Template (Binary) .vst ✅ Native (olefile)
Visio Stencil (Binary) .vss ✅ Native (olefile)

Documentation

Full documentation is available at libvisio-ng.readthedocs.io.

To build docs locally:

pip install sphinx sphinx-rtd-theme
cd docs && make html

Architecture

libvisio-ng uses libvisio (C++) as an architectural reference but is a pure Python implementation. The .vsd binary parser reads OLE2 structured storage and parses Visio's chunk-based record format to extract pages, shapes, text, geometry, and styling.

License

GPL-3.0-or-later

Author

Daniel Nylander daniel@danielnylander.se

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libvisio_ng-0.6.1.tar.gz (82.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libvisio_ng-0.6.1-py3-none-any.whl (74.0 kB view details)

Uploaded Python 3

File details

Details for the file libvisio_ng-0.6.1.tar.gz.

File metadata

  • Download URL: libvisio_ng-0.6.1.tar.gz
  • Upload date:
  • Size: 82.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for libvisio_ng-0.6.1.tar.gz
Algorithm Hash digest
SHA256 4ac116cca56ba96c36334719ec5c87f6184a0f8ff80a87060dc86b8ad3148e2e
MD5 e99c87ee926a247ee7525063ae863283
BLAKE2b-256 ed6e85857c0f94e592fe7e29bf6ea78618f217e843d4c073fb54d77fcda26b2b

See more details on using hashes here.

File details

Details for the file libvisio_ng-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: libvisio_ng-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 74.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for libvisio_ng-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 12c953b0673ca7e0608f463f1af29cbd33fb458d860939a41186b1215556ce27
MD5 4429c6af3f736de88fa7fc24eca6d158
BLAKE2b-256 497a52b7db2af26693a7355ba9d66d92a719bc27896b5d619538712b4ea2cafb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page