Skip to main content

CreateImageStampAnnot

Creates stamp annotation from an image. The annotation dimensions are taken from the loaded image, or updated after it has been loaded.

Syntax​

expression.CreateImageStampAnnot(position, imageSrc, author, creationDate);

expression - A variable that represents an Api class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
positionRequiredPoint | RectThe position of the upper-left corner of the annotation. For a Rect, only x1 and y1 are used.
imageSrcRequiredstringThe image source where the image should be taken from (currently, only internet URL or Base64 encoded images are supported).
authorOptionalstringname of the author
creationDateOptionalnumbercreation date (timeStamp)

Returns​

ApiStampAnnotation

Example​

Add an image stamp annotation to a PDF page.

// Create a PDF stamp annotation using an image URL.

// Place an image stamp at specified coordinates in a PDF.

let doc = Api.GetDocument();
let imageAnnot = Api.CreateImageStampAnnot(
[40, 40, 160, 100],
'https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png'
);
let page = doc.GetPage(0);
page.AddObject(imageAnnot);