Skip to content

FEATURE: Use range requests for PDF previews whenever possible, do not download entire file #3856

Open
@tillprochaska

Description

@tillprochaska

Is your feature request related to a problem? Please describe.
PDF files can be optimized to be served by web servers that support range requests. A range request only downloads a parts of a file, e.g. only the byte range required to render a specific page. PDF files that are optimized for this are often also referred to as "linearized" or "web optimized" PDF files.

Describe the solution you'd like

We could make better use of range requests:

Disable auto-fetching
We use pdf.js (via react-pdf) which supports range requests. In fact, PDF.js by default will try to use range requests if supported. This speeds up rendering of the first page. However, after downloading the part of the file required to render the first page, PDF.js will still try to preload the rest of the file in the background.

We should configure PDF.js to only load the parts of a PDF file that are required to render the currently visible page and nothing else. In many cases, users will view only a subset of the pages, not the entire document.

Linearize/optimize PDF files for range requests
PDF is a complex file format and not every PDF file is structured in a way that lends itself well to range requests. We could consider optimizing PDF files for range requests during ingestion (at least for files that are converted from a different file type to PDF).

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendIssues related to Aleph’s backend, API, CLI etc.feature-requestRequests for new features or enhancements of existing featuresuiIssues related to Aleph’s frontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions