跳到主要内容

AddDrawingToPage

Adds a shape to the specified page. 💡 This method can be a little bit slow, because it runs the document calculation process to arrange tables on the specified page.

Syntax

expression.AddDrawingToPage(oDrawing, nPage, x, y);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oDrawingRequiredApiDrawingA shape to add to the page.
nPageRequirednumberThe page number.
xRequiredEMUThe X coordinate in English measure units.
yRequiredEMUThe Y coordinate in English measure units.

Returns

boolean

Example

This example shows how to get a collection of tables on a given absolute page.

let doc = Api.GetDocument();
let drawing = Api.CreateImage("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png", 60 * 36000, 35 * 36000);
let paragraph = Api.CreateParagraph();
paragraph.AddPageBreak();
doc.Push(paragraph);
doc.AddDrawingToPage(drawing, 1, 50 * 36000, 50 * 36000);