WebViewer Client support for br/gzip for PDF streaming

Does the WebViewer Client support br/gzip compression when using streaming (byte ranges) pdfs? The demo app shows that its using an Accept-Encoding header of identity which basically tells the server not to compress. Any ideas how to get compression working when working with linearized pdfs?

2 Likes

This is exactly the issue I have because I am calling loadDocument with a URL that will do a redirect to a pre-signed URL.

It’s a pity that this doesn’t work:

documentViewer.loadDocument(self.options.documentPath, {
extension: ‘pdf’,
customHeaders: {
‘Accept-Encoding’:‘gzip, deflate, br, zstd’
}
}).then().catch(
err => self._handleDocumentLoadException(err, instance));

Gives this error:
webviewer-core.min.js:1569 Refused to set unsafe header “Accept-Encoding”

1 Like

From the load document method I use a Spring Boot REST url with a redirect to a pre-signed url. I noticed that this endpoint is called twice by Apryse webviewer before loading the pdf. The first time it is called with Accept-Encoding “identity” and the second time with the Accept-Encoding “gzip, deflate, br, zstd“. The first time I do not redirect. The second time I redirect to a GET pre-signed url. This works!

1 Like