If your application allows it you should preload WebViewer so that when your users want to view a document, WebViewer's JavaScript, HTML and CSS will already be loaded.
It's important that your server supports HTTP range requests properly so that WebViewer can load documents incrementally instead of having to download the entire file up front.
If you're serving your files statically from your server usually range requests will just work, however if you have your own endpoint for the file there are libraries that can handle range requests for you, or you could implement support yourself.
Ideally your PDF files are linearized which means that the contents of the file are arranged efficiently so that WebViewer can download the contents for specific pages.
You can linearize files using a PDF library like PDFNet on your server. Once files are linearized you'll also need to make sure that your server supports range requests.
If you are making a request to a document that is on a different origin than your web app then you may see this error even when the document loads successfully. WebViewer attempts to read the Content-Range response header as part of determining if the document is linearized, so failure to read it means that it won't be able to enable optimizations for linearized files.
You can expose this header to cross origin requests by including the Access-Control-Expose-Headers header in your response: Access-Control-Expose-Headers: Content-Range
.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales