Skip to main content

GetParentPage

Returns the type of the ApiDrawing class.

Inherited from ApiDrawing.GetParentPage.

Syntax​

expression.GetParentPage();

expression - A variable that represents an ApiSmartArt class.

Parameters​

This method doesn't have any parameters.

Returns​

ApiPage | null | undefined

Example​

Find the page that contains a shape in a PDF.

// How do I get the page number of a shape I'm viewing in a PDF?

// Locate which page an object belongs to in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 150 * 36000, 65 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
shape.SetSize(150 * 36000, 65 * 36000);

page.AddObject(shape);

const parentPage = shape.GetParentPage();
const sType = parentPage.GetClassType();
const docContent = shape.GetContent();
const paragraph = docContent.GetElement(0);
paragraph.SetJc("left");
paragraph.AddText("The index of the shape parent page = " + parentPage.GetIndex());