> 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/open-save-document/open/filesystem.md).

# Open a document from file system

Easilty open a document from the file system with WebViewer. The Apryse Web SDK streamlines secure, serverless document processing with robust support for JavaScript and TypeScript, and seamlessly int

## Opening a document in WebViewer from file system

## Enable File Browser Option

If you wish to allow users to open files from their local file system, you can enable this feature with:

{% tabs %}
{% tab title="Feature option" %}
You can enable the file picker with Features at any point in time.

{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    const { Feature } = instance.UI;
    instance.UI.enableFeatures([UI.Feature.FilePicker]);
  });
```

{% endcode %}

[UI.enableFeatures](https://sdk.apryse.com/api/web/UI.html#.enableFeatures__anchor) [Feature](https://sdk.apryse.com/api/web/UI.html#.Feature__anchor)

###

{% endtab %}

{% tab title="Constructor option" %}
You can also specify this via the WebViewer constructor at the very beginning.

{% code lineNumbers="true" %}

```js
WebViewer({
  ...
  enableFilePicker: true,
}).then(instance => {
    // ...
  });
```

{% endcode %}

[WebViewer Options](https://sdk.apryse.com/api/web/global.html#WebViewerOptions__anchor)
{% endtab %}
{% endtabs %}

And this option will be available to users in the top-right of the WebViewer UI:

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-0c9d146355ec5e2efe688be88ba43ac3ee852c91%2F4a16761c18d423f2fdb657fd2c0bc88844f66736-182x262.png?alt=media)

## With a File Object

If you have the [File](https://developer.mozilla.org/en-US/docs/Web/API/File/) object, from a file picker for example, you can pass the object directly to the loadDocument function. File objects are similar to [Blobs](/web/open-save-document/open/blob.md) and should load fine.

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

```js
<label for="file_upload">Choose A file</label>
<input type="file" id="file_upload" name="file_upload" accept=".pdf">

<div id='viewer' style='width: 1024px; height: 600px;'></div>

<script>
  const input = document.getElementById('file_upload');

  WebViewer(...)
    .then(instance => {
      input.addEventListener('change', () => {

        // Get the file from the input
        const file = input.files[0];
        instance.UI.loadDocument(file, { filename: file.name });
      });

      const { documentViewer } = instance.Core;
      documentViewer.addEventListener('documentLoaded', () => {
        // perform document operations
      });
    });
</script>
```

{% endcode %}

[UI.loadDocument](https://sdk.apryse.com/api/web/UI.html#loadDocument__anchor)
{% endtab %}

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

```js
<label for="file_upload">Choose A file</label>
<input type="file" id="file_upload" name="file_upload" accept=".pdf">

<div id='viewer' style='width: 1024px; height: 600px;'></div>

<script>
  const input = document.getElementById('file_upload');

  WebViewer(...)
    .then(instance => {
      input.addEventListener('change', () => {

        // Get the file from the input
        const file = input.files[0];
        instance.loadDocument(file, { filename: file.name });
      });

      const { docViewer } = instance;
      docViewer.on('documentLoaded', () => {
        // perform document operations
      });
    });
</script>
```

{% endcode %}

[WebViewerInstance.loadDocument](https://sdk.apryse.com/api/web/UI.html#loadDocument__anchor)
{% endtab %}
{% endtabs %}

## Loading Options

WebViewer provides various options to load a document. Whether you are loading a document through the `initialDoc` option in the constructor or calling `loadDocument` after mounting, you can always provide [options to load your document](/web/open-save-document/open.md#loading-options).


---

# 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/open-save-document/open/filesystem.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.
