> 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/best-practices/usedownloader-option.md).

# Streaming PDF Documents using JavaScript

Streamline PDF document streaming with JavaScript using the "Downloader" feature for efficient fetching of linearized files. Learn how to enable, disable, and requirements for optimal performance. The

{% hint style="info" %}
The **useDownloader option** is only applicable when loading PDF files. If you're loading XOD files then please go to [Streaming XOD documents ](/web/best-practices/streaming-option.md).
{% endhint %}

"Downloader" is a streaming feature of [client only mode](/web/what-is-webviewer/deployment-options.md#client-only) which allows it to efficiently fetch PDF files that have been linearized. The PDF spec describes linearization as a feature "that enables efficient incremental access of the file in a network environment."

By default downloader is enabled which allows WebViewer to quickly display the initial page in the document and download remaining pages incrementally for large linearized files.

{% hint style="info" %}
**Requirements for downloader to work**

* The PDF files are linearized. You can use [a native Apryse library](/core/get-started/readme.md) to linearize files.
* Byte range requests supported on your server. This should usually just work when serving your documents statically but you may need to use a library if you're serving them in a different way.
  {% endhint %}

## Disabling downloader

Generally it is **not** recommended to disable downloader because of the improved performance when loading linearized documents. It is only advisable if your server doesn't support byte range requests and you aren't able to enable them for some reason.

You also need to disable it if you are using [`doc.insertBlankPages`](https://sdk.apryse.com/api/web/Core.Document.html#insertBlankPages__anchor).

You can disable downloader as follows:

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

```js
WebViewer({
  initialDoc: "GettingStarted.pdf",
  useDownloader: false
}, viewerElement);
```

{% 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/best-practices/usedownloader-option.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.
