Metadata-Version: 2.4
Name: svg2pptx
Version: 1.0.1
Summary: Convert SVG files to native, editable PowerPoint shapes
Author: Rachid BENOUINI
License: MIT
Project-URL: Homepage, https://github.com/benouinirachid/svg2pptx
Project-URL: Repository, https://github.com/benouinirachid/svg2pptx
Keywords: svg,powerpoint,pptx,converter,vector,graphics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Topic :: Office/Business :: Office Suites
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: python-pptx>=0.6.21
Requires-Dist: svgpathtools>=1.6.1
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"

# SVG to PowerPoint Shape Converter

A Python library that converts SVG (Scalable Vector Graphics) files into native, editable PowerPoint shapes. Unlike simple image embedding, this tool parses SVG elements and recreates them as true PowerPoint objects—rectangles become rectangles, lines become lines, and text becomes editable text boxes.

## Installation

```bash
pip install svg2pptx
```

Or install from source:

```bash
git clone https://github.com/benouinirachid/svg2pptx.git
cd svg2pptx
pip install -e ".[dev]"
```

## Quick Start

```python
from svg2pptx import svg_to_pptx

# Convert SVG file to PowerPoint
svg_to_pptx("icon.svg", "output.pptx")
```

## CLI Usage

You can also use the command-line interface to convert files:

```bash
svg2pptx input.svg output.pptx [options]
```

### Options

| Option | Description |
|--------|-------------|
| `--no-text` | Skip converting text elements |
| `--no-shapes` | Skip converting shape elements |
| `--scale <float>` | Scale factor for the SVG content (default: 1.0) |
| `--flatten` | Flatten groups into individual shapes (default) |
| `--no-flatten` | Preserve group structure from SVG |

### Examples

```bash
# Basic conversion
svg2pptx diagram.svg presentation.pptx

# Scale up by 2x and skip text
svg2pptx chart.svg slide.pptx --scale 2.0 --no-text
```

## Features

- **Editable shapes** — Resize, recolor, and modify individual elements directly in PowerPoint
- **Native formatting** — Apply PowerPoint styles, themes, and animations to converted shapes
- **Smaller file sizes** — Vector shapes are lighter than embedded raster images
- **Preservation of structure** — Maintain layers, groups, and object hierarchy from your original design

## Supported SVG Elements

| Element | Support |
|---------|---------|
| `<rect>` | ✅ Full |
| `<circle>` | ✅ Full |
| `<ellipse>` | ✅ Full |
| `<line>` | ✅ Full |
| `<polygon>` | ✅ Full |
| `<polyline>` | ✅ Full |
| `<path>` | ✅ Approximated curves |
| `<g>` (groups) | ✅ Full |
| `<text>` | ✅ Basic |

## Configuration

```python
from svg2pptx import svg_to_pptx, Config

config = Config(
    scale=2.0,                  # Scale factor for SVG content
    curve_tolerance=0.5,        # Curve approximation quality (lower = more accurate)
    preserve_groups=True,       # Maintain SVG group structure
)

svg_to_pptx("diagram.svg", "output.pptx", config=config)
```

## Advanced Usage

```python
from svg2pptx import SVGConverter
from pptx import Presentation

# Add SVG shapes to an existing presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6])  # Blank layout

converter = SVGConverter()
converter.add_to_slide("icon.svg", slide)

prs.save("combined.pptx")
```

## Limitations

- **Bezier curves** are approximated with line segments (configurable tolerance)
- **Gradients** are not supported (will use first color)
- **Filters and effects** (blur, drop shadow) are not supported
- **CSS external stylesheets** are not supported

## License

MIT License
