Load a PDF as an array buffer

To load a PDF as an array buffer in Nutrient Web SDK, instead of passing the document URL directly in the configuration object, you can retrieve it with fetch() using the required credentials options (Nutrient Web SDK uses credentials: same-origin), and then pass it to PSPDFKit.load() as an ArrayBuffer, like this:

fetch(url, { credentials: "include" })
  .then((res) => res.arrayBuffer())
  .then((arrayBuffer) => {
    PSPDFKit.load({
      container: targetSelector,
      document: arrayBuffer
    });
  });

You’ll find more details about the PSPDFKit.Configuration#document property in our API reference.

This has been tested with Nutrient Web SDK 2020.2.3.