# PdfViewer

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Control](/api/wisej.web/general/control.md)
  * [PdfViewer](/api/wisej.web/content/pdfviewer.md)

Represents a [PdfViewer](/api/wisej.web/content/pdfviewer.md) control that can display a pdf document in the browser either using the native pdf viewer, the pdf.js viewer, Google docs, or a custom viewer.

{% tabs %}
{% tab title="C#" %}

```csharp
public class PdfViewer : Control, IWisejHandler
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class PdfViewer
    Inherits Control
    Implements IWisejHandler
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) PdfViewer()

Initializes a new instance of the [PdfViewer](/api/wisej.web/content/pdfviewer.md) class.

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) BorderStyle

[BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle.md): Indicates the border style for the control. (Default: `None`)

### ![](/files/hsR4ok3152WyAf8J2C1u) FileName

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the file name used in the "Content-Disposition" header when returning the PDF content to the PDF viewer. The name may be used when downloading the file, depending on the type of PDF viewer loaded in the browser. <mark style="color:blue;background-color:green;">Since 3.5.5</mark>

When [FileName](#filename) is not assigned, the PdfViewer will use the file name extracted from the [PdfSource](#pdfsource) property. When using the [PdfStream](#pdfstream) instead, the file name is left blank unless specified using the [FileName](#filename) property.

### ![](/files/hsR4ok3152WyAf8J2C1u) PdfSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the pdf file name to display in the [PdfViewer](/api/wisej.web/content/pdfviewer.md) control. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) PdfStream

[Stream](https://docs.microsoft.com/dotnet/api/system.io.stream): Returns or sets the pdf stream to display in the [PdfViewer](/api/wisej.web/content/pdfviewer.md) control.

### ![](/files/hsR4ok3152WyAf8J2C1u) ViewerType

[PdfViewerType](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md): Returns or sets the [PdfViewerType](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md) to use on the client. (Default: `Auto`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ViewerURL

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the URL of the PDF viewer to use on the client. It's required when [ViewerType](#viewertype) is [Custom](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md#fields), optional for [Mozilla](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md#fields) or [Google](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md#fields), and not used for [Auto](/api/wisej.web/content/pdfviewer/wisej.web.pdfviewertype.md#fields). (Default: `""`)

You can use the following placeholders in the ViewerURL string:

* \[source]: Replaced with the postback URL to the PdfViewer control that serves the PDF content.
* \[filename]: Replaced with the value of [FileName](#filename) and the ".pdf" extension in case the file name doesn't specify an extension.

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) OnPdfSourceChanged(e)

Fires the [PdfSourceChanged](#pdfsourcechanged) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                        | Description      |
| --------- | ----------------------------------------------------------- | ---------------- |
| **e**     | [WisejEventArgs](/api/wisej.core/general/wisejeventargs.md) | Event arguments. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) PdfSourceChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the PdfSource property is changed.

## Implements

| Name                                                                              | Description                                                                                                           |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.       |
| [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                         |
| [IDropTarget](/api/wisej.web/interfaces/wisej.web.idroptarget.md)                 | Controls that support drag & drop operations implement this interface.                                                |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                        |
| [IWisejControl](/api/wisej.core/interfaces/wisej.core.iwisejcontrol.md)           | All wisej controls derived from the [Control](/api/wisej.web/general/control.md) class must implement this interface. |
| [IWisejHandler](/api/wisej.core/interfaces/wisej.core.iwisejhandler.md)           | Represents a Wisej component that is capable of handling postback requests from the client.                           |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/content/pdfviewer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
