Skip to main content

SetTransparent

Sets the transparency of the fill.

Syntax​

expression.SetTransparent(transparent);

expression - A variable that represents an ApiFill class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
transparentRequirednumberThe transparency value, from 0 (fully opaque) to 1 (fully transparent).

Returns​

boolean

Example​

Make a shape's fill semi-transparent on a page in a PDF.

// Adjust how see-through a shape's fill is in a PDF.

// Fade a shape's solid fill so the page content behind it shows through in a PDF.

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

const fill = Api.CreateSolidFill(Api.RGB(255, 200, 100));
fill.SetTransparent(0.4);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 150 * 36000, 65 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
page.AddObject(shape);