# ViewDestination Class

> Represents a particular view of a page in a document.

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

```cpp
class ViewDestination
```

**Namespace:** `datalogics_interface`

## Description

A destination describes a place in the PDF document where the user will be taken in response to clicking a hyperlink. The destination defines where a bookmark or hyperlink points to.

The ViewDestination contains a reference to a page, a place (rectangle) on that page, and information specifying how to adjust the view to fit the window's size and shape.

**Referenced by:** [`Bookmark`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/Bookmark.md), [`GoToAction`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/GoToAction.md), [`LinkAnnotation`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LinkAnnotation.md)

**Uses types:** [`PDFArray`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/PDFArray.md), [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/struct/Rect.md)

## Constructors

### ViewDestination

```cpp
datalogics_interface::ViewDestination::ViewDestination(Document &doc, int page_number, const std::string &fit_type, const Rect &rect, double zoom)
```

*constructor*

**Parameters**

- `doc` ([`Document &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/Document.md)): Containing document
- `page_number` (`int`): Target page number
- `fit_type` (`const std::string &`): Fit Type must be: "XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "FitBH", or "FitBV".
- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/struct/Rect.md)): Target rectangle
- `zoom` (`double`): Zoom level

General purpose constructor: construct with all elements

### ViewDestination

```cpp
datalogics_interface::ViewDestination::ViewDestination(ViewDestination &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`ViewDestination &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/ViewDestination.md))

### ~ViewDestination

```cpp
datalogics_interface::ViewDestination::~ViewDestination()
```

*destructor*

## Fields

### null_value

```cpp
static double datalogics_interface::ViewDestination::null_value
```

*static*

Constant used for "null" values in destination rectangles or zoom.

## Methods

### get_dest_rect

```cpp
Rect datalogics_interface::ViewDestination::get_dest_rect() const
```

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

The destination rectangle for this view.

Coordinates with a value of NullValue indicate that the corresponding coordinate is not specified in the destination.

### get_fit_type

```cpp
std::string datalogics_interface::ViewDestination::get_fit_type() const
```

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

The fit type string for this destination.

The fit type determines how the page content is fitted into the window. Valid fit types are: "XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "FitBH", and "FitBV".

### get_page_number

```cpp
int datalogics_interface::ViewDestination::get_page_number() const
```

**Returns:** `int`

The zero-based page number for this destination.

The page number of the destination.

### get_pdf_array

```cpp
std::unique_ptr< PDFArray > datalogics_interface::ViewDestination::get_pdf_array()
```

**Returns:** [`std::unique_ptr< PDFArray >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/PDFArray.md)

The underlying PDF array object for this destination.

Retrieve the PDFArray representation of this ViewDestination.

### get_zoom

```cpp
double datalogics_interface::ViewDestination::get_zoom() const
```

**Returns:** `double`

The zoom factor, or NullValue if not set.

A value of NullValue indicates that the zoom factor is not specified.

### operator=

```cpp
ViewDestination & datalogics_interface::ViewDestination::operator=(ViewDestination &&) noexcept
```

**Parameters**

- (unnamed) ([`ViewDestination &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/ViewDestination.md))

**Returns:** [`ViewDestination &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/ViewDestination.md)

### operator==

```cpp
bool datalogics_interface::ViewDestination::operator==(const ViewDestination &other) const
```

**Parameters**

- `other` ([`const ViewDestination &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/ViewDestination.md)): The ViewDestination to compare against.

**Returns:** `bool`

true if the two ViewDestination objects refer to the same destination, false otherwise.

Two ViewDestination objects are considered equal if their underlying PDF Cos objects are equal.

### set_dest_rect

```cpp
void datalogics_interface::ViewDestination::set_dest_rect(const Rect &rect)
```

**Parameters**

- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/struct/Rect.md)): The rectangle defining the visible area of the destination page.

**Returns:** `void`

Set the destination rectangle of the view.

### set_fit_type

```cpp
void datalogics_interface::ViewDestination::set_fit_type(const std::string &fit_type)
```

**Parameters**

- `fit_type` (`const std::string &`): The fit type string. Must be one of: "XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "FitBH", or "FitBV".

**Returns:** `void`

Set the fit type for the view.

### set_page_number

```cpp
void datalogics_interface::ViewDestination::set_page_number(int page_number)
```

**Parameters**

- `page_number` (`int`): The zero-based page number to set as the destination.

**Returns:** `void`

Set the page number of the destination starting at 0.

### set_zoom

```cpp
void datalogics_interface::ViewDestination::set_zoom(double zoom)
```

**Parameters**

- `zoom` (`double`): The zoom level to apply when navigating to this destination.

**Returns:** `void`

Set the zoom factor for the destination.

### to_string

```cpp
std::string datalogics_interface::ViewDestination::to_string() const
```

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

A formatted string describing this ViewDestination.

The string includes the page number, fit type, destination rectangle, and zoom factor.
