> 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/guides/migrating-to-v4.md).

# Migrating to v4

Migrating to v4? Learn about the key changes: Case updates, jQuery removal, async annotations, default viewer switch, and more. Ensure a smooth transition with these essential insights. The Apryse Web

There are a few **breaking changes** when migrating to v4 from older versions.

## Case change

UpperCamelCase in the main files, `WebViewer.min.js` and `WebViewer.js`, have been updated to lowercase.

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

```html
<!-- Version 3.x and older -->
<script src='lib/WebViewer.min.js'></script>

<!-- Version 4.0 and after -->
<script src='lib/webviewer.min.js'></script>
```

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

## No more jQuery

From 4.0, you don't need to load jquery before WebViewer anymore.

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

```html
<!-- Version 3.x and older -->
<script src='lib/html5/external/jquery-3.2.1.min.js'></script>

<!-- Version 4.0 and after -->
<!-- nothing! -->
```

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

This means that event-listening functions need to be updated too.

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

```js
// Version 3.x and older
$(viewerElement).on('documentLoaded', function() {
  ...
});

// Version 4.0 and after
viewerElement.addEventListener('documentLoaded', function() {
  ...
});

// Version 3.x and older
$(viewerElement).on('pageChanged', function(e, pageNumber) {
  console.log(pageNumber);
});

// Version 4.0 and after
viewerElement.addEventListener('pageChanged', function(e) {
  const [ pageNumber ] = e.detail;
  console.log(pageNumber);
});
```

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

## AnnotationManager drawAnnotations is asynchronous

The [drawAnnotations](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#drawAnnotations__anchor) function is now asynchronous and returns a promise that resolves when drawing has completed.

Generally this won't cause problems for existing code as long as subsequent code isn't relying on the annotation drawing to have completed. If you do rely on this then you'll just need to move the code into a then block. For example:

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

```js
// Version 3.x and older
annotManager.drawAnnotations(1);
// something that relies on the annotations to be finished drawing

// Version 4.0 and after
annotManager.drawAnnotations(1).then(function() {
  // something that relies on the annotations to be finished drawing
});
```

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

## New default viewer

The default viewer has been updated to WebViewer UI v1, which means that customizations you've made to the UI for the legacy viewer will not work anymore. Note that the new default viewer does not support IE9 or 10. If you want to support IE9 and 10 you will need to use the legacy viewer.

Also note that customizations using the [WebViewer core](/web/ui-customization/core.md) APIs remain mostly unchanged so those customizations will continue to work.


---

# 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/guides/migrating-to-v4.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.
