> 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/readme/jquery.md).

# How to integrate WebViewer into a JQuery PDF Viewer

Generate, view, edit PDF files with JQuery PDF viewer

This guide will show you how to integrate [WebViewer Document Viewer & Editor](https://apryse.com/products/webviewer) into a jQuery application.

You can also download a ready-to-go sample on [GitHub](https://github.com/ApryseSDK/webviewer-samples/tree/main/webviewer-jquery).

## Prerequisites

Prior to starting, you should have already installed [Node](https://nodejs.org/) and [npm](https://www.npmjs.com/).

Get your Apryse trial key.

{% @apryse-license-key/apryse-license-key platform="WEB\_VIEWER" variant="full" %}

***

### Get started video

In this 4-minute video, learn the fundamentals of Apryse WebViewer, including key concepts for installation and initialization in any web application.

{% embed url="<https://www.youtube.com/embed/UIIWdERmBtU?si=ZIOH-IIi9PqhqEDv>" %}
Overview of Apryse WebViewer fundamentals, including installation and initialization.
{% endembed %}

## Get Started with the Sample

### 1. Clone the Sample

Clone the [jQuery sample](https://github.com/ApryseSDK/webviewer-samples/tree/main/webviewer-jquery) by executing

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
git clone --depth=1 https://github.com/ApryseSDK/webviewer-samples.git
cd webviewer-samples
```

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

Once cloned, navigate into the `webviewer-jquery` directory and install all the required dependencies by executing

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm install
```

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

npm will also download the Apryse WebViewer and extract it to `/src/lib`.

### 2. Run the sample

To run the sample, navigate to your `webviewer-jquery` directory and execute

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm start
```

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

Then navigate to `http://localhost:3000`. You should see the application load on your browser.

### 3. Usage

To call more WebViewer API's, navigate to `/src/app/app.js` and add the API calls in the callback of the WebViewer constructor (you may need to make one if it is not provided). Add your own license key in place of 'YOUR\_LICENSE\_KEY'.

{% tabs %}
{% tab title="JavaScript (SDK v8.0+)" %}

<pre class="language-js" data-line-numbers><code class="lang-js">WebViewer({
    path: '../lib',
    licenseKey: '<code class="expression">visitor.claims.wvKey || "YOUR_LICENSE_KEY"</code>', // sign up to get a key at https://dev.apryse.com
    initialDoc: '../files/webviewer-demo-annotated.pdf'
}, document.getElementById('viewer'))
    .then(instance => {
        // In this callback WebViewer will be initialized, so you can call WebViewer API here.
        instance.UI.setTheme('light');
    });
</code></pre>

{% endtab %}

{% tab title="JavaScript (SDK v6.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer({
    path: '../lib',
    initialDoc: '../files/webviewer-demo-annotated.pdf'
}, document.getElementById('viewer'))
    .then(instance => {
        // In this callback WebViewer will be initialized, so you can call WebViewer API here.
        instance.setTheme('light');
    });
```

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

If your jQuery application is already running, you should see the theme change by refreshing the page. Otherwise execute `npm start` again, then navigate to `http://localhost:3000` and you should see that the theme has changed.

## Next step

<a href="/web/what-is-webviewer/usage.md" class="button primary">Usage</a><a href="/web/get-started/guides.md" class="button primary">Guides</a><a href="/web/get-started/samples.md" class="button primary">Samples</a><a href="https://sdk.apryse.com/api/web/index.html" class="button primary">API docs</a>


---

# 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/readme/jquery.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.
