Why do I get Unhandled Rejection (TypeError): documentViewer.getDocument(...).documentCompletePromise is not a function?

Some of the sample code for generating PDFs from Office Templates uses the method
documentCompletePromise() to pause execution until the document contents have been fully loaded.

Typically the code looks like:
await documentViewer.getDocument().documentCompletePromise();

This function was removed in v10.0, which causes a documentCompletePromise is not a function message to be shown.

The solution is to use the replacement function with getDocumentCompletePromise();

1 Like