# ICustomHighlight

## Content

# Interface: ICustomHighlight

Represents a custom highlight within a document.

## Properties

### borderColor?

```ts
optional borderColor: string;
```

The color of the highlight border in `rgba`, `hex`, or named color format.
If not specified, defaults to 'rgba(255, 165, 0, 0.75)'.

***

### borderWidth?

```ts
optional borderWidth: number;
```

The width of the highlight border in pixels.
If not specified, defaults to 2 pixels.

***

### color?

```ts
optional color: string;
```

The fill color of the highlight in `rgba`, `hex`, or named color format.
If not specified, defaults to 'rgba(255, 255, 0, 0.5)'.

***

### paintHandler()?

```ts
optional paintHandler: (ctx, highlight) => void;
```

A custom function to handle the painting of the highlight.

#### Parameters

##### ctx

`CanvasRenderingContext2D`

The rendering context of the canvas to draw on.

##### highlight

`ICustomHighlight`

The highlight object containing details for painting.

#### Returns

`void`

***

### rects

```ts
rects: (
  | number[]
  | {
  h: number;
  w: number;
  x: number;
  y: number;
})[];
```

An array of rectangles that specify the position and dimensions of the highlight areas on the page.
Each rectangle can be defined in one of two formats:

1. **Object format**:
   - `{ x: number, y: number, w: number, h: number }`
   - `x` and `y` represent the coordinates of the rectangle's bottom-left corner.
   - `w` (width) represents the horizontal size of the rectangle, extending to the right from `x`.
   - `h` (height) represents the vertical size of the rectangle, extending upwards from `y`.

2. **Array format**:
   - `[x1: number, y1: number, x2: number, y2: number]`
   - `x1` and `y1` represent the coordinates of the rectangle's bottom-left corner.
   - `x2` and `y2` represent the coordinates of the rectangle's top-right corner.

**Coordinate System**:
- The coordinate system's origin (0, 0) is at the bottom-left corner of the page.
- Coordinates `x` and `y` increase to the right and upwards, respectively.
- Width (`w`) extends to the right from the `x` position, and height (`h`) extends upwards from the `y` position.
- All measurements (x, y, w, h) are in pdf points (pt).

***

### text?

```ts
optional text: string;
```

The text content associated with the highlight.
