API Reference
Main API
- libvisio_ng.convert(input_path, output_dir=None)
Convert a Visio file to SVG pages.
Returns a list of SVG file paths (one per page). Uses libvisio if available, otherwise built-in .vsdx parser.
- libvisio_ng.convert_page(input_path, page_index, output_dir)
Convert a specific page of a Visio file to SVG. Returns SVG path or None.
- libvisio_ng.get_page_info(input_path)[source]
Get page names and shape data from a Visio file.
Returns list of dicts: [{“name”: “Page-1”, “shapes”: […], “index”: 0}, …]
- libvisio_ng.extract_text(input_path)
Extract all text from a Visio file.
VSD Binary Parser
- libvisio_ng.parse_vsd_file(file_path)[source]
Parse a .vsd file and return a VsdDocument.
- Parameters:
- Return type:
- libvisio_ng.parse_vsd_to_dicts(file_path)[source]
Parse a .vsd file and return page data compatible with the VSDX SVG renderer.
Returns list of dicts with page_width, page_height, shapes, name.
- class libvisio_ng.VsdDocument(pages: 'list' = <factory>, colors: 'list' = <factory>, fonts: 'dict' = <factory>, names: 'dict' = <factory>, stencil_pages: 'list' = <factory>)[source]
- class libvisio_ng.VsdPage(page_id: 'int' = 0, name: 'str' = '', width: 'float' = 8.5, height: 'float' = 11.0, shapes: 'list' = <factory>, background: 'bool' = False)[source]
- class libvisio_ng.VsdShape(shape_id: 'int' = 0, shape_type: 'str' = 'Shape', parent: 'int' = 0, master_page: 'int' = -1, master_shape: 'int' = -1, xform: 'XForm' = <factory>, text_xform: 'TextXForm | None' = None, xform_1d: 'XForm1D | None' = None, text: 'str' = '', geometry: 'list' = <factory>, char_formats: 'list' = <factory>, para_formats: 'list' = <factory>, line_weight: 'float' = 0.01, line_color: 'str' = '#000000', line_pattern: 'int' = 1, fill_foreground: 'str' = '', fill_background: 'str' = '', fill_pattern: 'int' = 1, shadow_offset_x: 'float' = 0.0, shadow_offset_y: 'float' = 0.0, shadow_color: 'str' = '', shadow_pattern: 'int' = 0, children: 'list' = <factory>, sub_shapes: 'list' = <factory>, layer_member: 'str' = '', foreign_data: 'ForeignData | None' = None, connection_points: 'list' = <factory>, text_block_bg: 'str' = '', text_block_margin_left: 'float' = 0.0, text_block_margin_right: 'float' = 0.0, text_block_margin_top: 'float' = 0.0, text_block_margin_bottom: 'float' = 0.0, text_block_valign: 'int' = 0)[source]
- Parameters:
shape_id (int)
shape_type (str)
parent (int)
master_page (int)
master_shape (int)
xform (XForm)
text_xform (TextXForm | None)
xform_1d (XForm1D | None)
text (str)
geometry (list)
char_formats (list)
para_formats (list)
line_weight (float)
line_color (str)
line_pattern (int)
fill_foreground (str)
fill_background (str)
fill_pattern (int)
shadow_offset_x (float)
shadow_offset_y (float)
shadow_color (str)
shadow_pattern (int)
children (list)
sub_shapes (list)
layer_member (str)
foreign_data (ForeignData | None)
connection_points (list)
text_block_bg (str)
text_block_margin_left (float)
text_block_margin_right (float)
text_block_margin_top (float)
text_block_margin_bottom (float)
text_block_valign (int)
- class libvisio_ng.TextXForm(txt_pin_x=0.0, txt_pin_y=0.0, txt_width=0.0, txt_height=0.0, txt_loc_pin_x=0.0, txt_loc_pin_y=0.0, txt_angle=0.0)[source]
Text block transform — positions text independently of shape.
- class libvisio_ng.XForm1D(begin_x=0.0, begin_y=0.0, end_x=0.0, end_y=0.0)[source]
1D connector endpoints.
- class libvisio_ng.ParaFormat(char_count: 'int' = 0, indent_first: 'float' = 0.0, indent_left: 'float' = 0.0, indent_right: 'float' = 0.0, spacing_line: 'float' = -1.2, spacing_before: 'float' = 0.0, spacing_after: 'float' = 0.0, horiz_align: 'int' = 0, bullet: 'int' = 0, bullet_str: 'str' = '')[source]
Constants
- libvisio_ng.VISIO_EXTENSIONS = {'.vsd', '.vsdm', '.vsdx'}
set() -> new empty set object set(iterable) -> new set object
Build an unordered collection of unique elements.
- libvisio_ng.TEMPLATE_EXTENSIONS = {'.vst', '.vstm', '.vstx'}
set() -> new empty set object set(iterable) -> new set object
Build an unordered collection of unique elements.
- libvisio_ng.STENCIL_EXTENSIONS = {'.vss', '.vssm', '.vssx'}
set() -> new empty set object set(iterable) -> new set object
Build an unordered collection of unique elements.
- libvisio_ng.ALL_EXTENSIONS = {'.vsd', '.vsdm', '.vsdx', '.vss', '.vssm', '.vssx', '.vst', '.vstm', '.vstx'}
set() -> new empty set object set(iterable) -> new set object
Build an unordered collection of unique elements.