You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cookbook/index.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,4 +17,21 @@ You can set [`textLayerMode`](/learned-knowledge/#textlayermode) option to 0 to
17
17
18
18
## How to setup `Range Request` only download necessary data?
19
19
20
-
See the comment by me in the [discussion](https://github.com/mozilla/pdf.js/discussions/18524#discussioncomment-10202877).
20
+
The `Range Request` only works if you use the default pdf.js viewer. if not, you have to implement all by yourself to
21
+
support `Range Request`. Even if you use the default viewer, the server must also be configured to
22
+
support [Range Request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) correctly.
23
+
24
+
For those who already use the default viewer and still suffer this issue, go through the checklist to ensure your server was configured correctly:
25
+
26
+
- Make sure you didn't set the `disableRange` option
27
+
- Make sure the first get request that downloads the pdf return 200 or 206.
28
+
- Make sure the first get request has the right `Content-Length`, `Accept-Ranges` and `Content-Encoding` header
29
+
- The `Content-Length` should be larger then `2 * rangeChunkSize`, the default [rangeChunkSize](https://github.com/mozilla/pdf.js/blob/f6b356eff753358bf3263d174dc0cf4852800edd/src/display/api.js#L76C7-L76C31) is 65536
30
+
- The `Accept-Ranges` should be `bytes` and the server must really support it
31
+
- The `Content-Encoding` should be `identity` if present
32
+
33
+
If you ensure all these were configured correctly, then you can debug the code block step by step to find out what's the real issue.
0 commit comments