@pptx-editor. dev/ core/ output
Functions (3)
paintSlidefunctionSource ↗
Paint a slide into a new <svg> sized by viewBox in EMU. The caller sets CSS size.
declare function paintSlide(doc: Document, layout: SlideLayout, opts: PaintOptions): SVGSVGElement;pathDatafunctionSource ↗
Path data for an evaluated path in local EMU.
declare function pathData(path: GeometryPath): string;registerFontFacesfunctionSource ↗
Add faces to doc.fonts. Bytes are copied into the FontFace; nothing touches disk.
declare function registerFontFaces(doc: Document, faces: readonly RegisteredFace[], options?: RegisterFontFacesOptions): FontFaceHandle;Interfaces (5)
FontFaceHandleinterfaceSource ↗
Registered faces, removable when the document closes.
interface FontFaceHandle| Member | Type | Summary |
|---|---|---|
| dispose | | |
| ready | Promise<void> | Settles when every face loads or fails, or after `FACE_LOAD_WAIT_MS`: a face whose load never settles cannot hold the open. Paint uses a late face once it loads. |
PaintContextinterfaceSource ↗
What paint needs from its host.
interface PaintContext| Member | Type | Summary |
|---|---|---|
| defs | Defs | |
| fillPath? | string | The path being filled (SVG path data), for `path="shape"` gradients. Paint sets it for each filled path; a host leaves it unset. |
| groupFill? | ResolvedFill | The enclosing group's fill, for `a:grpFill`. |
| groupSourcePart? | string | |
| images | ImageUrlPort | |
| imageSize? | ImageSizePort | Natural image sizes, for tiled pictures. Without it, a tile is the shape's size. |
| sourcePart | string | The part whose relationships resolve this element's `r:embed` ids. |
PaintOptionsinterfaceSource ↗
Paint options.
interface PaintOptions| Member | Type | Summary |
|---|---|---|
| altText? | AltTextPort | The alt text of an element. With it, each picture is exposed to assistive technology: a picture with a description is an image named by it, and a decorative picture or one with no description is hidden. Without it, the paint has no ARIA (thumbnails and exports). |
| frameLabel? | (kind: string) => string | Label for an element the editor does not render (chart, diagram, OLE). |
| hitTargets? | boolean | Include `data-node-id` hooks for hit testing. Default true. |
| idPrefix | string | Unique prefix for ids in this SVG (several slides can share a page). |
| images | ImageUrlPort | Resolves a relationship id from a source part to an image URL. |
| imageSize? | ImageSizePort | Resolves a relationship id to the image's natural size, for tiled pictures. |
| view? | ViewRect | The part of slide space that can show, in EMU. A text line or a table cell wholly outside it does not paint, unless its shape casts copies of itself (a shadow, a reflection, a glow). Without it, everything paints. A thumbnail shows the slide; the editing surface shows what its view can reach. |
RegisterFontFacesOptionsinterfaceSource ↗
Options of registerFontFaces.
interface RegisterFontFacesOptions| Member | Type | Summary |
|---|---|---|
| family? | (face: RegisteredFace) => string | The family name of each face in the font set: the face's id when not given. A host that paints under other names (and rewrites the painted family names) gives them here. |
| waitMs? | number | The longest `ready` waits. Defaults to `FACE_LOAD_WAIT_MS`. |
ViewRectinterfaceSource ↗
A rectangle of slide space, in EMU.
interface ViewRect| Member | Type | Summary |
|---|---|---|
| height | number | The height. |
| width | number | The width. |
| x | number | The left edge, from the slide's left edge. |
| y | number | The top edge, from the slide's top edge. |
Type aliases (3)
AltTextPorttypeSource ↗
Resolves an element (p:cNvPr/@descr and the adec:decorative extension) to its alt text.
type AltTextPort = (part: string, nodeId: string) => {
readonly description: string;
readonly decorative: boolean;
} | undefined;ImageSizePorttypeSource ↗
Resolves a picture fill's relationship id to the image's natural size in EMU, for tiles. Use the header's resolution, or 72 DPI when it states none (measured on reference PDFs) (DocumentSession.imageSize). The store's imageSizeEmu defaults to 96 DPI, so a port built on it passes { ...size, dpiX: size.dpiX ?? 72, dpiY: size.dpiY ?? 72 }.
type ImageSizePort = (sourcePart: string, rId: string) => {
readonly cx: number;
readonly cy: number;
} | undefined;ImageUrlPorttypeSource ↗
Resolves a picture fill's relationship id to a displayable URL (never a remote fetch).
type ImageUrlPort = (sourcePart: string, rId: string) => string | undefined;Variables (1)
SVG_NSconstSource ↗
SVG_NS = "http://www.w3.org/2000/svg"