Skip to main content

SetShadow

Sets the shadow to the current graphic object.

Inherited from ApiDrawing.SetShadow.

Syntax​

expression.SetShadow(shadow);

expression - A variable that represents an ApiChart class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
shadowRequiredApiShadow | null | undefinedThe shadow to apply, or null to remove the current shadow.

Returns​

boolean

Example​

Apply an outer shadow to a drawing on a page in a PDF form.

// Give a shape a soft offset shadow so it appears lifted off the page.

// Create a shape, build a shadow, and set it on the drawing with SetShadow.

const doc = Api.GetDocument();
const page = doc.GetPage(0);
const fill = Api.CreateSolidFill(Api.RGB(255, 213, 191));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 120 * 36000, 60 * 36000, fill, stroke);
shape.SetPosition(30 * 36000, 30 * 36000);
page.AddObject(shape);
shape.SetShadow(Api.CreateShadow({ color: Api.RGB(64, 64, 64), transparency: 0.3, offsetX: 4, offsetY: 4 }));