All time pending promise for image compare

I have an error with this promise: const getImageData = (doc, pageIndex) => {
return new Promise(resolve => {
pageNumber: pageIndex,
drawComplete: (pageCanvas) => {
const ctx = pageCanvas.getContext(‘2d’);
const imageData = ctx.getImageData(0, 0, pageCanvas.width, pageCanvas.height);

when I try to do image compare
This pomise is all time pending

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi Yaroslav,

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.