docx
    Preparing search index...

    Class Media

    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;
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Adds an image to the media collection.

      Parameters

      • key: string

        Unique identifier for this image

      • mediaData: IMediaData

        Complete image data including file name, transformation, and raw data

      Returns void