An AI-editable PowerPoint layer: inspect, edit and re-render .pptx decks losslessly, through a Python API or…
pptx-agent
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An AI-editable PowerPoint layer for Python: inspect a deck, change it through a semantic API,
render it back to an image, repeat.
The agent never writes XML or SVG. It looks at pixels, understands structure through inspection,
mutates a semantic model, and looks again.
To give a model the deck as tool calls (Claude, or OpenAI's Responses and Chat Completions
APIs): using the tools with a model provider.
Install
Not on PyPI yet. Python 3.10+. The siblings install from git:
Editing needs only lxml, ooxml-common and ooxml-edit; rendering is delegated to
pptx2svg (the render and png extras).
**pptx2svg-fonts is the fonts the PNGs are drawn with** (about 11 MB): Carlito, Arimo,
Tinos and Cousine, stand-ins with the advance widths of Calibri, Arial, Times New Roman and
Courier New; Caladea for Cambria; Noto Sans JP for Japanese and Chinese text; Lato and
Raleway. They are under the SIL Open Font License 1.1, with their licence texts in the
package; its code is MIT; no Microsoft font is in it. Without it a render draws with the
machine's own fonts, and text none of them can draw -- every CJK character, on a server
with no CJK font -- is left out of the image: render then says so (missing_glyphs),
and pptx2svg warns. Faces of your own, in a folder the system does not search, are
Document.font_dirs (or Toolbox(font_dirs=...) for the tools), or the environment
variable OOXML_FONT_DIRS: rendered and measured with
(tools/README.md).
The user's regional settings -- a chart's decimal separator, the language of a date field
that states none, of a new deck and of new text -- are Document.locale (or
Toolbox(locale=...)), an ooxml_common.locales.Locale; en-US unless given, never the
server's own.
Example
Ids are stable (" . ", never positions), and the rendered SVG tags every
shape with the same id, so an agent can point at what it sees. Open and save reproduces
every part of a deck byte for byte.
Where values placed from a source came from -- a table or a chart the agent tools built
from a dataset or another document's table -- is kept in the deck, as a tag on the
table's or chart's frame that PowerPoint keeps through a save, and read back with
Document.open("deck.pptx").provenance() -> {frame address: record}
({"v": 1, "source": "t:sales", "document": "budget.xlsx", "columns": [...]}).
What is supported
- **Library:** open and save (.pptx, .potx), text with formatting, notes, fills,
outlines and theme colours, tables, charts (with their embedded workbooks), SmartArt
nodes, shapes, pictures, connectors, groups, comments, slides and layouts, Markdown
outlines in and out, fit and collision checks, layout helpers, design facts, undo and
redo, SVG and PNG rendering. The full table: docs/FEATURES.md.
- **Agent tools** (pptx_agent.tools): the deck through tool calls for a model, on
ooxml_edit.tools. What they support and do not:
SUPPORTED.md; guidance for the application's
thinking layer: GUIDANCE.md.