Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,17 @@ PREVIEWER_PREFERENCE = DEFAULT_PREVIEWER_PREFERENCE + [
"cds_rdm_gltf_previewer",
]

PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS = {
"disableStream": True,
"disableRange": True,
"disableAutoFetch": True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curiosity: what did the autofetch do?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disableAutoFetch stops PDF.js from downloading extra bits of the PDF in the background before you actually need them like when you scroll down to the second page of the pdf, autofetch would fetch bits for the second page while you're scrolling so I turned off all three (disableRange, disableStream, disableAutoFetch) so the preview loads the file in one go instead of several small requests to the same PDF

}
"""PDF.js initialization parameters for document previewer.

We disable range requests and streaming, to avoid overloading the server with
multiple requests per PDF preview.
"""

PREVIEWER_MAX_IMAGE_SIZE_BYTES = 15 * (10**6) # 15 MB
"""Maximum file size in bytes for image files."""

Expand Down
Loading