# ASP.NET Core PDFViewer Overview

The Telerik UI PDFViewer TagHelper and HtmlHelper for ASP.NET Core are server-side wrappers for the Kendo UI PDFViewer widget.

The PDFViewer displays PDF files in the browser and consists of a toolbar and a scrollable container that wraps the page elements. The default tools collection includes the `pager`, `open`, and `download` tools. For processing files, it supports the PDF.JS Processing and Telerik DPL Processing libraries. Among the key features the PDFViewer provides are the selection of a PDF processing library, a built-in paging mechanism, virtualization capabilities, a built-in default toolbar collection, and responsive capabilities and page scaling.

* [Demo page for the PDFViewer](https://demos.telerik.com/aspnet-core/pdfviewer/index)

## Initializing the PDFViewer

You can initialize the PDFViewer from HTML either by using [PDF.JS](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/overview#using-pdfjs) or [the Telerik Document Processing library](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/overview#using-telerik-document-processing).

### Using PDF.JS

The following example demonstrates how to initialize the PDFViewer by using [PDF.JS](https://mozilla.github.io/pdf.js/).

```C# Program.cs
    builder.Services.AddKendo(x => x.RenderAsModule = true);
```

```Razor HtmlHelper
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.mjs" type="module"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.worker.mjs" type="module"></script>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js" type="module"></script>
    <script src="https://cdn.jsdelivr.net/npm/@progress/kendo-ui@2024.4.1112/umd/kendo.all.min.js" type="module"></script>
    <script src="https://cdn.jsdelivr.net/npm/@progress/kendo-ui@2024.4.1112/umd/kendo.aspnetmvc.min.js" type="module"></script>

    @(Html.Kendo().PDFViewer()
        .Name("pdfviewer") // The name of the PDFViewer is mandatory. It specifies the "id" attribute of the component.
        .PdfjsProcessing(pdf => pdf
            .File(Url.Content("~/Content/web/pdfViewer/sample.pdf"))
        )
        .Height(1200)
    )
```

```Razor TagHelper
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.mjs" type="module"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.worker.mjs" type="module"></script>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js" type="module"></script>
    <script src="https://cdn.jsdelivr.net/npm/@progress/kendo-ui@2024.4.1112/umd/kendo.all.min.js" type="module"></script>
    <script src="https://cdn.jsdelivr.net/npm/@progress/kendo-ui@2024.4.1112/umd/kendo.aspnetmvc.min.js" type="module"></script>

    <kendo-pdfviewer name="pdfviewer" height="1200">
        <pdfjs-processing file="@Url.Content("~/Content/web/pdfViewer/sample.pdf")"/>
    </kendo-pdfviewer>
```

### Using Telerik Document Processing

The following example demonstrates how to initialize the PDFViewer by using the [Telerik Document Processing library](https://docs.telerik.com/devtools/document-processing/introduction).

```Razor HtmlHelper
    @(Html.Kendo().PDFViewer()
        .Name("pdfviewer") // The name of the PDFViewer is mandatory. It specifies the "id" attribute of the widget.
        .DplProcessing(dpl => {
            dpl.Read(r => r.Url(Url.Action("GetInitialPdf", "PdfViewer")));
            dpl.Upload(upload => upload.Url(Url.Action("GetPdf", "PdfViewer")).SaveField("file"));
            dpl.LoadOnDemand(true);
        })
        .Toolbar(toolbar =>
            toolbar.Items(items =>
            {
                items.Add().Command("PageChangeCommand").Type("pager").Name("pager");
                items.Add().Name("spacer").Type("spacer");
                items.Add().Command("OpenCommand").Type("button").Name("open").Icon("folder-open");
            })
        )
        .Height(1200)
    )
```

```Razor TagHelper
    <kendo-pdfviewer height="1200"
                     name="pdfviewer">
        <dpl-processing load-on-demand="true">
            <read url="/PdfViewer/GetInitialPdf" />
            <upload url="/PdfViewer/GetPdf" save-field="file" />
        </dpl-processing>
        <toolbar enabled="true">
            <pdfviewer-toolbar-items>
                <pdfviewer-toolbar-item command="PageChangeCommand"
                                        type="pager"
                                        name="pager">
                </pdfviewer-toolbar-item>
                <pdfviewer-toolbar-item name="spacer"
                                        type="spacer">
                </pdfviewer-toolbar-item>
                <pdfviewer-toolbar-item command="OpenCommand"
                                        type="button"
                                        name="open"
                                        icon="folder-open">
                </pdfviewer-toolbar-item>
            </pdfviewer-toolbar-items>
        </toolbar>
    </kendo-pdfviewer>
```

## Functionality and Features

* [PDF.js Processing](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/pdfjs-processing)—You can configure the PDFViewer to use the PDF.js library for PDF processing and visualization.
* [DPL Processing](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/dpl-processing)—The component can use the Telerik Document Processing library to process and visualize a PDF document.
* [Toolbar and Tools](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/toolbar)—The PDFViewer offers diverse tools and commands.
* [Annotations](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/annotations)—You can highlight important text areas with different colors or add free text notes in the document.
* [Form Filling](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/form-filling)—You can import files containing PDF forms and fill in the input elements.
* [Events](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/events)—To control the behavior of the component upon user interaction, you can use the events that the component emits.
* [Accessibility](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/accessibility/overview)—The PDFViewer is accessible for screen readers, supports WAI-ARIA attributes, and delivers [keyboard shortcuts](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/accessibility/keyboard-navigation) for faster navigation.

## Next Steps

* [Getting Started with the PDFViewer](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/getting-started)
* [Basic Usage of the PDFViewer HtmlHelper and TagHelper for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/pdfviewer)
* [Using the PDFViewer with the Telerik Document Processing library (Demo)](https://demos.telerik.com/aspnet-core/pdfviewer/dpl-processing)

## See Also

* [Basic Usage of the PDFViewer for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/pdfviewer/index)

* [PDFViewer in Razor Pages](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/pdf/pdfviewer/razor-page)

* [Using the API of the PDFViewer HtmlHelper for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/pdfviewer/api)

* [Knowledge Base Section](https://www.telerik.com/aspnet-core-ui/documentation/knowledge-base)
