Conversation
|
@RooTooRD is attempting to deploy a commit to the CloudPDF Team on Vercel. A member of the Team first needs to authorize it. |
RooTooRD
force-pushed
the
range-loading-v2
branch
2 times, most recently
from
September 15, 2026 05:50
aa0abd1 to
629dd20
Compare
RooTooRD
force-pushed
the
range-loading-v2
branch
from
September 15, 2026 05:52
629dd20 to
399fa34
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add incremental HTTP byte-range loading for URL-based PDFs in the PDFium worker engine.
FPDF_LoadCustomDocumentopenDocumentUrl()calls through the workerLast-ModifiedwithIf-Rangewhen availableWhy this runs in the worker
PDFium's
FPDF_FILEACCESS.GetBlockcallback is synchronous. Serving uncached ranges therefore requires synchronous network reads.The range implementation is enabled only in the dedicated PDFium worker so these reads never block the browser's main thread. The direct engine continues using full-fetch loading.
Compatibility and fallbacks
Full-fetch loading is retained when:
mode: 'full-fetch'is selectedcredentials: 'omit'is requestedfetcheris configured206response is receivedIf a range fails after the document opens, the worker synchronously requests the complete file and continues only when its length and all previously cached bytes match. If the complete response conflicts with bytes PDFium has already consumed, the current operation rejects instead of silently producing incomplete output.
Relative URLs are resolved before crossing the worker boundary, while malformed URLs reject through the returned
PdfTask.The current WASM
FPDF_FILEACCESSlayout uses a 32-bit file length, so custom range loading is limited to PDFs smaller than 4 GiB.Validation
pnpm --filter @embedpdf/engines test— 4 suites and 22 testspnpm --filter @embedpdf/engines... buildbytes=0-262143bytes=786432-1016314416, a complete GET is validated against cached bytes, and every page renders identically to the normal range pathsaveAsCopy()and close test for a range-backed document4without a passwordCloses #7
Closes #287
Closes #540