# LineTo Class

> A lineto operator, which draws a straight line.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/LineTo
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class LineTo : Segment
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`Segment`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Segment.md)

## Description

A lineto operator, which draws a straight line.

A lineto operator creates a line path element. It draws a straight line from the current position (MoveTo) to a new position-a new set of (x,y) coordinates: MoveTo{x:0 y:50} LineTo{x:100 y:100}

**Uses types:** [`Point`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)

## Constructors

### LineTo

```cpp
datalogics_interface::LineTo::LineTo(const Point &pt)
```

*constructor*

**Parameters**

- `pt` ([`const Point &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): The destination point for the line segment.

Create a line to a new point.

Append a straight line segment from the current point to the lineToPoint. The new current point is the point the line is drawn to.

### LineTo

```cpp
datalogics_interface::LineTo::LineTo(double x, double y)
```

*constructor*

**Parameters**

- `x` (`double`): The destination point for the line segment.
- `y` (`double`)

Create a line to a new point.

Append a straight line segment from the current point to the lineToPoint. The new current point is the point the line is drawn to.

### ~LineTo

```cpp
datalogics_interface::LineTo::~LineTo() override
```

*destructor*

## Methods

### point

```cpp
Point datalogics_interface::LineTo::point() const
```

**Returns:** [`Point`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)

The destination of the line-to.

### to_string

```cpp
std::string datalogics_interface::LineTo::to_string() const override
```

**Returns:** `std::string`

Represents a segment, or a single line, within a path.
