> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/samples/webviewer-blazor-wasm.md).

# Integrate WebViewer into Blazor WASM

This sample integrates WebViewer into a Blazor WebAssembly Project

This sample shows how to integrate the Apryse WebViewer into a Blazor project using the Blazor WebAssembly application template

WebViewer provides a slick out-of-the-box responsive UI that enables you to view, annotate and manipulate PDFs and other document types inside any web project.

Click the button below to view the full project in GitHub.

{% tabs %}
{% tab title="index.html" %}
{% code title="index.html" lineNumbers="true" %}

```html
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>BlazorWebViewerWebAssembly</title>
    <base href="/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="lib/webviewer.min.js" type="module"></script>
</head>

<body>
    <app>Loading...</app>

    <div id="blazor-error-ui">
        An unhandled error has occurred.
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>
    <script src="_framework/blazor.webassembly.js"></script>
    <script src="js/webviewerScripts.js"></script>
</body>

</html>

```

{% endcode %}
{% endtab %}

{% tab title="webviewerScripts.js" %}
{% code title="webviewerScripts.js" lineNumbers="true" %}

```js
window.webviewerFunctions = {
  initWebViewer: function () {
      const viewerElement = document.getElementById('viewer');
      WebViewer({
          path: 'lib',
          initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf', // replace with your own PDF file
      }, viewerElement).then((instance) => {
          // call apis here
      })
  }
};
```

{% endcode %}
{% endtab %}

{% tab title="Webviewer.razor" %}
{% code title="Webviewer.razor" lineNumbers="true" %}

```razor
@inject IJSRuntime JSRuntime

<h1>WebViewer</h1>
<div id='viewer' style='width: 1024px; height: 600px; margin: 0 auto;'></div>

@code {
    protected override async void OnAfterRender(bool firstRender)
    {
      if (firstRender) {
        await JSRuntime.InvokeAsync<object>("webviewerFunctions.initWebViewer");
      }
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Index.razor" %}
{% code title="Index.razor" lineNumbers="true" %}

```razor
﻿@page "/"

<WebViewer/>

@code{}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/web/get-started/samples/webviewer-blazor-wasm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
