PPTX
Comments
Add comments (annotations) to slides for review and collaboration
Adding Comments
Use the comments option on each slide to add comments with author, text, and position:
import { Presentation, Packer, Shape } from "@office-open/pptx";
const pres = new Presentation({
slides: [
{
children: [
new Shape({
x: 50,
y: 30,
width: 500,
height: 60,
text: "Slide with Comments",
fill: "4472C4",
}),
],
comments: [
{
author: "Alice Wang",
text: "The title looks great!",
x: 200,
y: 50,
date: "2026-05-15T10:00:00Z",
},
{
author: "Bob Li",
text: "Consider changing the content color.",
x: 300,
y: 180,
initials: "BL",
date: "2026-05-15T11:00:00Z",
},
],
},
],
});
const buffer = await Packer.toBuffer(pres);
Comment Options
| Property | Type | Description |
|---|---|---|
author | string | Author display name |
text | string | Comment text content |
x | number | Horizontal position of the comment marker (px) |
y | number | Vertical position of the comment marker (px) |
initials | string | Author initials (auto-derived from name if omitted) |
date | string | ISO 8601 date string |
Author Deduplication
Authors are automatically deduplicated across all slides. If the same author name appears on multiple slides, they share a single author entry with a unified initials and color index.