PDF Embed API: Linearized PDFs not displaying first page before rest is loaded
Hi.
We are using the PDF embed API to display PDFs to our end users.
We are requesting the PDF from a client CDN, which delivers the PDF in a byte-stream.
I have looked up both the documentation regarding linearized PDFs, as well as the sample demo on github. As many of our requested PDF are large, it is crucial to fix this issue to improve use experience.
All the promises are resolved in what i believe is the correct order:
getInfo => Metadata (which returns fileSize)
getInitialBuffer => Initial 1024 bits (which returns a buffer: [ArrayBuffer(1025)])
getFileBufferRanges => fetches the requested ranges (awaits all promises, returnes bufferList: ArrayBuffer[])
Below are some images of our setup, as well as the header for the requested PDF.
Thanks in advance!
Header for the requested PDF:

Code using the URL directly, letting the API handle needed promises:

Code using a promise with linearizationObject (separated in two images):


