> 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
