@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
MemberTypeSummary
dispose
readyPromise<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
MemberTypeSummary
defsDefs
fillPath?stringThe path being filled (SVG path data), for `path="shape"` gradients. Paint sets it for each filled path; a host leaves it unset.
groupFill?ResolvedFillThe enclosing group's fill, for `a:grpFill`.
groupSourcePart?string
imagesImageUrlPort
imageSize?ImageSizePortNatural image sizes, for tiled pictures. Without it, a tile is the shape's size.
sourcePartstringThe part whose relationships resolve this element's `r:embed` ids.

PaintOptionsinterfaceSource ↗

Paint options.

interface PaintOptions
MemberTypeSummary
altText?AltTextPortThe 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) => stringLabel for an element the editor does not render (chart, diagram, OLE).
hitTargets?booleanInclude `data-node-id` hooks for hit testing. Default true.
idPrefixstringUnique prefix for ids in this SVG (several slides can share a page).
imagesImageUrlPortResolves a relationship id from a source part to an image URL.
imageSize?ImageSizePortResolves a relationship id to the image's natural size, for tiled pictures.
view?ViewRectThe 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
MemberTypeSummary
family?(face: RegisteredFace) => stringThe 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?numberThe longest `ready` waits. Defaults to `FACE_LOAD_WAIT_MS`.

ViewRectinterfaceSource ↗

A rectangle of slide space, in EMU.

interface ViewRect
MemberTypeSummary
heightnumberThe height.
widthnumberThe width.
xnumberThe left edge, from the slide's left edge.
ynumberThe 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"