ReferenceAPI
Presentation
Create, open, render, check and save a deck.
Create, open, render, check and save a deck. The same text agents read through help().
Presentation.create
Section titled “Presentation.create”create(options: { size?: SlideSize; theme?: ThemePresetName | ThemePreset | string } = {}): PresentationStarts a new deck: Presentation.create() is 16:9 (1280×720 px); also “4:3” or { width, height } in px.
theme applies a preset: Presentation.create({ theme: "ledger" }) (see theme.use).
Options: SlideSize, ThemePresetName, ThemePreset.
Presentation.create()Presentation.create({ theme: "ledger" })Presentation.fromTemplate
Section titled “Presentation.fromTemplate”fromTemplate(source: string | Uint8Array, options: { keepSlides?: boolean } = {}): Promise<Presentation>Starts a deck from a template (a company .potx or any .pptx): its theme, masters and layouts,
without its slides unless keepSlides. slides.add({ layout: "Title and Content", title })
then uses the template’s own layouts, by key or by the name PowerPoint shows.
slides.add({ layout: "Title and Content", title })Presentation.open
Section titled “Presentation.open”open(source: string | Uint8Array): Promise<Presentation>Opens an existing .pptx (or a .potx template) to read, render, check and edit. Saving writes
the edits back into a copy of the file: everything you did not change stays as it was.
const deck = await Presentation.open("q3.pptx").
const deck = await Presentation.open("q3.pptx")Presentation.record
Section titled “Presentation.record”record(options: { size?: SlideSize } = {}): RecordingA new deck that records every change as a JSON op log: replayable elsewhere with the same
anchors (Presentation.resume), undoable step by step, and open to ops sent as JSON.
const rec = Presentation.record(); rec.deck.slides.add({ title: "Q3" }); rec.undo();
Options: SlideSize.
const rec = Presentation.record(); rec.deck.slides.add({ title: "Q3" }); rec.undo();Presentation.resume
Section titled “Presentation.resume”resume(json: OpLogJSON): RecordingRebuilds a recorded deck from recording.toJSON() and keeps recording.
Options: OpLogJSON.
recording.toJSON()deck.comments
Section titled “deck.comments”Who writes comments. Threads themselves are started with slide.comment().
deck.comments.authors
Section titled “deck.comments.authors”authors: readonly CommentAuthor[]Everyone who has commented, in order.
deck.comments.items
Section titled “deck.comments.items”items: readonly SlideComment[]Every thread in the deck, slide by slide.
deck.comments.setAuthor
Section titled “deck.comments.setAuthor”setAuthor(input: CommentAuthorInput): CommentAuthorSets the author of the comments that follow (added once, reused by name):
deck.comments.setAuthor({ name: "Ada Byron", userId: "[email protected]" }).
Options: CommentAuthorInput.
deck.finalize
Section titled “deck.finalize”finalize(options: FinalizeOptions): Promise<FinalizeResult>Checks the real file and publishes it safely: validation, package integrity, the requirements
you state, chart data, lint (errors block unless waived) and a re-read of the written file.
Never overwrites; writes a receipt and a manifest.
await deck.finalize({ output: "out/q3.pptx", requirements: { slideCount: 10, nativeCharts: [slide.id] } })
Options: FinalizeOptions.
await deck.finalize({ output: "out/q3.pptx", requirements: { slideCount: 10, nativeCharts: [slide.id] } })deck.footer
Section titled “deck.footer”Footer text, slide numbers and the date across the deck.
deck.footer.set
Section titled “deck.footer.set”set(options: FooterOptions): voidShows footer text, the slide number and/or a date on every slide (slides can opt out with slide.footer = false).
Options: FooterOptions.
deck.help
Section titled “deck.help”help(query?: string | HelpOptions, options: HelpOptions = {}): stringAPI help from the generated catalog, sized for a context window: deck.help("slide.charts.add"),
deck.help("ShapeOptions.textBox"), deck.help({ search: "gradient" }), or deck.help() for the overview.
Options: HelpOptions.
deck.help("slide.charts.add")deck.help("ShapeOptions.textBox")deck.help({ search: "gradient" })deck.help()deck.inspect
Section titled “deck.inspect”inspect(options: InspectOptions = {}): InspectResultThe deck as bounded NDJSON records with stable anchors: one line per slide, text box, shape,
image, table, chart and notes page, with boxes, wrapped line counts and overflow flags.
deck.inspect({ kind: "text", slide: 2 }), deck.inspect({ search: "ARR" }),
deck.inspect({ target: "sh_X1C8ZP3R", before: 2, after: 2 }).
Options: InspectOptions.
deck.inspect({ kind: "text", slide: 2 })deck.inspect({ search: "ARR" })deck.inspect({ target: "sh_X1C8ZP3R", before: 2, after: 2 })deck.layouts
Section titled “deck.layouts”layouts: LayoutsThe eleven standard layouts.
deck.lint
Section titled “deck.lint”lint(options: LintOptions = {}): LintResultChecks the deck against the v1 rules (overflow, off-canvas, overlap, text size, contrast,
placeholders, images, fonts, chart titles, connectors) on the same layout the renderer draws.
Errors block finalize(); warnings are worth a look at the render.
deck.lint(), deck.lint({ rules: "text/", severity: "error", slide: 3 }).
Options: LintOptions.
deck.lint()deck.lint({ rules: "text/", severity: "error", slide: 3 })deck.master
Section titled “deck.master”master: MasterThe slide master: background, text styles and decorations shared by every slide.
deck.opened
Section titled “deck.opened”opened: booleanTrue for decks opened from a file (edits are saved back into it).
deck.render
Section titled “deck.render”render(options: RenderOptions & { slides?: number[] } = {}): Promise<Uint8Array[]>Renders slides to images (all by default), so an agent can look at its work. slides are slide
numbers as PowerPoint shows them, from 1: deck.render({ slides: [1, 3] }).
Options: RenderOptions.
deck.render({ slides: [1, 3] })deck.renderMontage
Section titled “deck.renderMontage”renderMontage(options: MontageOptions & { slides?: number[] } = {}): Promise<Uint8Array>Renders slides as one contact-sheet image with slide numbers; slides count from 1.
Options: MontageOptions.
deck.resolve
Section titled “deck.resolve”resolve(id: `sl_${string}`): Slideresolve(id: `th_${string}`): SlideCommentresolve(id: string): Slide | SlideElement | SlideCommentThe live object behind an anchor from inspect(): a Slide, or a Shape, Picture, Table, Chart,
Connector or Group on a slide, layout or the master. Edit it in place, e.g.
(deck.resolve("sh_X1C8ZP3R") as Shape).replaceText("48%", "49%").
(deck.resolve("sh_X1C8ZP3R") as Shape).replaceText("48%", "49%")deck.save
Section titled “deck.save”save(path: string, options: { manifest?: boolean } = {}): Promise<void>Writes the deck to a .pptx file. { manifest: true } also writes <path>.manifest.ndjson, the
inspect() records, so other tools can read the deck without parsing OOXML.
{ manifest: true }deck.size
Section titled “deck.size”size: { width: number; height: number }Slide size in px: { width: 1280, height: 720 } for 16:9.
deck.slides
Section titled “deck.slides”The slides in order: deck.slides.add({ layout, title, body }), deck.slides.remove(id),
deck.slides.move(id, 0).
deck.slides.add({ layout, title, body })deck.slides.remove(id)deck.slides.move(id, 0)deck.slides.[Symbol.iterator]
Section titled “deck.slides.[Symbol.iterator]”[Symbol.iterator](): Iterator<Slide>for (const slide of deck.slides) works.
for (const slide of deck.slides)deck.slides.add
Section titled “deck.slides.add”add(options: SlideOptions = {}): SlideAdds a slide. Pick a layout and fill its placeholders by name:
slides.add({ layout: "title-and-content", title: "Q3", body: ["Revenue up 18%", "Costs flat"] }).
Options: SlideOptions.
slides.add({ layout: "title-and-content", title: "Q3", body: ["Revenue up 18%", "Costs flat"] })deck.slides.at
Section titled “deck.slides.at”at(index: number): Slide | undefinedThe slide at a position (negative counts from the end): deck.slides.at(-1).
deck.slides.at(-1)deck.slides.clear
Section titled “deck.slides.clear”clear(): voidDeletes every slide, to build the deck again from the start: deck.slides.clear(). The theme,
layouts and masters stay. To redo one slide, use slide.clear() instead.
deck.slides.clear()slide.clear()deck.slides.duplicate
Section titled “deck.slides.duplicate”duplicate(slide: Slide | string, at?: number): SlideCopies a slide (with its notes and comments) and puts the copy right after it, or at at:
const copy = deck.slides.duplicate("sl_7Q2M4K9A"). The copy’s objects get new ids.
const copy = deck.slides.duplicate("sl_7Q2M4K9A")deck.slides.filter
Section titled “deck.slides.filter”filter(fn: (slide: Slide, index: number) => boolean): Slide[]The slides that pass the test, in order.
deck.slides.find
Section titled “deck.slides.find”find(fn: (slide: Slide, index: number) => boolean): Slide | undefinedThe first slide that passes the test.
deck.slides.forEach
Section titled “deck.slides.forEach”forEach(fn: (slide: Slide, index: number) => void): voidLike Array.forEach over the slides, in order.
deck.slides.get
Section titled “deck.slides.get”get(slide: string | number): SlideA slide by anchor id or by position, 0 being first: deck.slides.get("sl_7Q2M4K9A"),
deck.slides.get(0). Throws, listing the slides there are, when there is no such slide.
deck.slides.get("sl_7Q2M4K9A")deck.slides.get(0)deck.slides.length
Section titled “deck.slides.length”length: numberHow many slides the deck has.
deck.slides.map
Section titled “deck.slides.map”map(fn: (slide: Slide, index: number) => T): T[]Like Array.map over the slides, in order.
deck.slides.move
Section titled “deck.slides.move”move(slide: Slide | string, to: number): voidMoves a slide to a position, 0 being first: deck.slides.move("sl_7Q2M4K9A", 0).
deck.slides.move("sl_7Q2M4K9A", 0)deck.slides.remove
Section titled “deck.slides.remove”remove(slide: Slide | string): voidDeletes a slide (by reference or anchor id) with its notes and comments: deck.slides.remove("sl_7Q2M4K9A").
deck.slides.remove("sl_7Q2M4K9A")deck.theme
Section titled “deck.theme”theme: ThemeTheme colors and fonts: deck.theme.set({ colors: { accent1: "#2346C8" }, fonts: { heading: "Inter" } }).
deck.theme.set({ colors: { accent1: "#2346C8" }, fonts: { heading: "Inter" } })deck.toBytes
Section titled “deck.toBytes”toBytes(): Promise<Uint8Array>Encodes the deck as .pptx bytes using the Artiwright engine.
deck.toProto
Section titled “deck.toProto”toProto(): pb.DocumentThe document model as a protobuf message.