DominikPalo
Oct 13, 2022Iron Contributor
Status:
New
PowerPoint JS API: Add support for getting dimensions of slides
Currently, only the https://learn.microsoft.com/en-us/javascript/api/powerpoint/powerpoint.shape?view=powerpoint-js-preview class has the https://learn.microsoft.com/en-us/javascript/api/powerpoint/p...
Tjerkdb345
Jul 15, 2025Copper Contributor
You can (with a workaround) get the dimensions of a slide. Here is a simple example:
var slideImg = slide.getImageAsBase64();
await slide.context.sync();
//create an new image (that wont be loaded) based on the bas64 string and set the dimensions
const img = new Image();
img.src = "data:image/jpeg;base64, " + slideImg.value;
await img.decode();
return { width: img.width, height: img.height };
Pawlu
Aug 14, 2025Brass Contributor
We're also using `getImageAsBase64()` in order to get the slide width/height. However, we found it does have issues since you need to convert from pixels to points which is dependant on the user's DPI. Its nice to have but we really need MS to give us the dimensions.