Manages embedded media (images) in a document.
Media stores all images referenced in the document and provides access to their data for packaging into the DOCX file. Each image is stored with a unique key for retrieval.
const media = new Media();media.addImage("image1", { type: "png", fileName: "image1.png", transformation: { pixels: { x: 200, y: 100 }, emus: { x: 1828800, y: 914400 } }, data: imageBuffer});const allImages = media.Array; Copy
const media = new Media();media.addImage("image1", { type: "png", fileName: "image1.png", transformation: { pixels: { x: 200, y: 100 }, emus: { x: 1828800, y: 914400 } }, data: imageBuffer});const allImages = media.Array;
Gets all images as an array.
Read-only array of all media data in the collection
Adds an image to the media collection.
Unique identifier for this image
Complete image data including file name, transformation, and raw data
Manages embedded media (images) in a document.
Media stores all images referenced in the document and provides access to their data for packaging into the DOCX file. Each image is stored with a unique key for retrieval.
Example