Skip to content

PdfJsKit v1.6.2

Latest
Compare
Choose a tag to compare
@GleamTech GleamTech released this 04 Mar 00:55

Version 1.6.2 - March 3, 2025

  • Added: debugMode option, a value indicating whether to show details in text box in the addition to the main message on error dialog.
    So from now on, by default, error details should not be shown on PdfViewer's error dialog, for example no details should be shown on local PDF opening errors:

    image

    If you explicitly set this option to true, it will show details in text box in the addition to the main message on error dialog. This was the default behavior before v1.6.2:

    image

    This can be useful for debugging purpose.

  • Improved: failed event can now be canceled via e.preventDefault() to suppress showing default error dialog.
    For example, e.detail.message can be examined and a custom message can be shown via pdfViewer._showError() method.

    var pdfViewer = new PdfViewer({
        events: {
          failed:  pdfViewerFailed
        }    
    });
    
    function pdfViewerFailed(e) {
        var pdfViewer = e.target;
    
        if (e.detail.message == "some specific message") {
            //Canceling this event, to suppress showing error dialog with default error message.
            e.preventDefault();
    
            //Show your custom message with error dialog
            pdfViewer._showError("customMessage");
    
            //Or write to browser console
            console.log("customMessage");
        }
    }