Moving PDFJS check into promise

Before we load pdf, check if PDFJS is defined. If not, reject promise and send error message, instead of having a check that just returns and stop the script if undefined.