Signature/Image Insertion
Function Description
After integrating with business system, signatures/images can be inserted at specified positions in the document.
Notes
- The following uses inserting floating image as example. To insert inline image, use
InlineShapes.addPictureAPI. addPictureonly supports passingFileobject, need to convert image resource (such as base64) toFileobject in advance.
Code Examples
Example 1: Insert floating image in current selection
async function insertPicture(file, width, height, wrapType) {
const shape = await app.ActiveDocument.Shapes.addPicture(
file,
undefined,
undefined,
width,
height,
undefined,
wrapType
);
}
Example 2: Insert floating image at specified bookmark position
async function insertPicture(file, width, height, wrapType) {
const bm = await app.ActiveDocument.Bookmarks.item('bm1');
const range = await bm.range;
const shape = await app.ActiveDocument.Shapes.addPicture(
file,
undefined,
undefined,
width,
height,
range,
wrapType
);
}
Example 3: Insert floating image at specified editable area position
async function insertPicture(file, width, height, wrapType) {
const pm = await app.ActiveDocument.PermMarks.item('pm1');
const range = await pm.range;
const shape = await app.ActiveDocument.Shapes.addPicture(
file,
undefined,
undefined,
width,
height,
range,
wrapType
);
}