---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/SetGray
---

# SetGray

## Overview

`SetGray` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `BasicSetColorOperator`.

g — Set gray fill color.

This class provides 7 methods for working with SetGray objects in .NET programs.
Available methods include: `Accept`, `IsTextShowOperator`, `SetGray`, `ToPdf`, `ToString`, `ValueEquals`, `getColor`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `B`, `C`, `Color`, `CommandName`, `G`, `Gray`, and 5 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Gray` | `double` | Read/Write | Gets or sets the gray. |
| `Color` | `double[]` | Read | Gets the color. |
| `R` | `double` | Read | Gets the r. |
| `G` | `double` | Read | Gets the g. |
| `B` | `double` | Read | Gets the b. |
| `C` | `double` | Read | Gets the c. |
| `M` | `double` | Read | Gets the m. |
| `Y` | `double` | Read | Gets the y. |
| `K` | `double` | Read | Gets the k. |
| `CommandName` | `string` | Read | The PDF command name (last token of the serialised form, e.g. |
| `Index` | `int` | Read/Write | 1-based position of this operator within its containing OperatorCollection. |

## Methods

| Signature | Description |
|-----------|-------------|
| `SetGray(gray: double)` | Sets the gray value. |
| `ToPdf()` | Calls ToPdf on this SetGray instance. |
| `ToString()` | Calls ToString on this SetGray instance. |
| `Accept(visitor: IOperatorSelector)` | Calls Accept on this SetGray instance. |
| `getColor()` | Calls getColor on this SetGray instance. |
| `IsTextShowOperator(op: Operator)` | True when op is a text-showing operator (Tj / TJ / ' / " — concrete subclasses of TextShowOperator). |
| `ValueEquals(op: Operator)` | True when this operator's serialised PDF form equals op's. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)