Loading pdfs with partials content 206

WebViewer Version:

Do you have an issue with a specific file(s)? NO
Can you reproduce using one of our samples or online demos? NO
Are you using the WebViewer server? NO
Does the issue only happen on certain browsers? NO
Is your issue related to a front-end framework? YES
Is your issue related to annotations? NO

Please give a brief summary of your issue:
We are using Webviewer in order to download a PDF file returned from our WebApi (dotnet core). We cannot get many 206 responses that will eventually download the whole file.

Please describe your issue and provide steps to reproduce it:

We are loading the file using a blob with loadDocument like the following:

await this.viewerInstance.loadDocument(file.blob, {
extension: ‘pdf’
})

On backend we tried to return

  1. return File(result.Stream, “application/pdf”, result.FileName, enableRangeProcessing: true);

  2. or even a custom response

    Response.StatusCode = StatusCodes.Status206PartialContent;
    Response.Headers.Add(“Accept-Ranges”, “bytes”);
    Response.Headers.Add(“Content-Length”, contentLength.ToString());
    Response.Headers.Add(“Content-Range”, $“bytes {rangeStart}-{rangeEnd}/{result.FileSize}”);

    var inputStream = new MemoryStream();
    await result.Stream.CopyToAsync(inputStream); // TEMPORARY SOLUTION

    inputStream.Seek(rangeStart, SeekOrigin.Begin);

    var buffer = new byte[contentLength];
    inputStream.Read(buffer, 0, (int)contentLength);

In the case of simply returning a response with enableRangeProcessing, results with downloading the entire file.
And in the case of custom response, we only have 1 206 response and nothing else.

The file we are serving through web api is linearized.
We are on “@pdftron/webviewer”: “8.4.0”

Please provide a link to a minimal sample where the issue is reproducible: We are in POC stage for now…

Hi there,

It looks like there is already a duplicate support ticket related to this topic, we will move the discussion there.

Best regards,
Kevin Kim