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

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)

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.0.tar.gz (79.5 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.0-py3-none-any.whl (73.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: libvisio_ng-0.6.0.tar.gz
  • Upload date:
  • Size: 79.5 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.0.tar.gz
Algorithm Hash digest
SHA256 3a1e1c218965fc111b3957ad89a0d9a0ff518965a73f07822845698953bd584c
MD5 45db9848c127627045fe5884f1417edc
BLAKE2b-256 4a785aa42bbc26339de1646741a911621d9e3173b6c9b16f15aee334cc54186e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libvisio_ng-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 73.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28ee2117a2cb2e3ec07428b29caa84066ea16638c93b793a661c4efae3a686f5
MD5 ea5e668654143b640756187dc2630d33
BLAKE2b-256 3dbe4bf84dcd915cace598d8cc563d65d6943b9d4f36b8452e279b4ffc77d540

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