Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tillprochaska opened this issue Aug 28, 2024 · 0 comments
Labels
backend Issues related to Aleph’s backend, API, CLI etc. feature-request Requests for new features or enhancements of existing features ui Issues related to Aleph’s frontend

Comments

@tillprochaska
Copy link
Contributor

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).

@tillprochaska tillprochaska added ui Issues related to Aleph’s frontend backend Issues related to Aleph’s backend, API, CLI etc. feature-request Requests for new features or enhancements of existing features labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Issues related to Aleph’s backend, API, CLI etc. feature-request Requests for new features or enhancements of existing features ui Issues related to Aleph’s frontend
Projects
None yet
Development

No branches or pull requests

1 participant