Using the HttpPartRetriever

Hey Guys,

Trying to make use of the low level apis in PDF JS Express 7.3.5.

We operate a custom DRM server (similar to XOD) and would like to stream and decrypt ranges of PDFs documents.

I’ve had a go at using the HttpPartRetriever with the following code:

  CoreControls.getDefaultBackendType().then(async (backendType: any) => {

    const retriever = await PartRetrievers.getPartRetriever(PartRetrievers.Types.HttpPartRetriever, "",
      decrypt: (part: any) => magicDecrypt(part)

    const options = {
      workerTransportPromise: CoreControls.initPDFWorkerTransports(backendType, {})

    doc.loadAsync(retriever, (data: any) => {
    }, options);


However I’m getting the error: “partRetriever.getFile” is not a function.

I have also tried doing this through WebViewerInstance.loadDocument like so:

  instance.loadDocument("", {
    extension: "xod",
    xodOptions: {
      decrypt: (arg: any) => magicDecrypt(arg) 

But receive the error: “Document type “xod” is not registered with CoreControls.Document”.

Any assistance on how to decrypt documents would be greatly appreciated.


Just on the above - wondering if the range / xod functionality is available with the PDFJS Express library at all, or we’d need to use PDFTron?

1 Like

Also interested in the answer to this question ? is DRM support and Range Requests supported in the edition

Unfortunately, PDFjs Express only supports PDF file types and does not have XOD support. For multiple file types, you will need PDFTron.

Thanks for the response driley.

Is the HttpPartRetriever supported in PDFJS Express for regular PDF’s?

Also, we currently use vanilla PDFJS and grab ranges of PDF’s via a custom PDFDataRangeTransport (which can be provided to PDFJS’s getDocument function). I don’t support this is available in PDFJS Express too?

Hi UnclePete,

HttpPartRetriever was intended to be used with XOD files so unfortunately, it will not work with PDF files and PDF.js Express. If you want to use this functionality the best option is to use PDFTron.


Thanks Dustin

It is unfortunate as it was looking like a good solution for us.
I think the express documentation needs to be more clear and remove the ability to explore these functions - it has wasted a bit of time.

Thanks again and terrific product

Hi everyone,

PDF.js Express does support range requests by default (only for PDFs) and will use them whenever available. There is no additional configuration required on the client as it is enabled by default. However, the PDF file must be linearized and your file server must be set up to support range requests as well.

That being said, any functionality beyond what is being provided will be tricky as this is mostly handled by the internals of the core PDF.js library. If you absolutely require these more advanced use cases (streaming encrypted files etc), then PDFTron is your best bet.