I tried your function and it seems to work correctly as long as the parameters passed are valid.
Are you maybe passing 0 as a pageIndex to that function?
In this case, the promise will not be fulfilled as page 0 is not a valid pageNumber for document.loadCanvas (page numbers are 1 indexed not 0 indexed) and the promise doesn’t have any rejections for erroring cases.
Please let me know if this is not the case and provide the parameters you are passing to that function.
Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc. www.pdftron.com