public void keyPressed(KeyEvent e) {
        if (document == null)
            return;
        int c = e.getKeyCode();
        int m = e.getModifiers();
        if ((c == KeyEventConstants.KEY_CODE_SAVE_AS && m == KeyEventConstants.MODIFIER_SAVE_AS) ||
                (c == KeyEventConstants.KEY_CODE_PRINT_SETUP && m == KeyEventConstants.MODIFIER_PRINT_SETUP) ||
                (c == KeyEventConstants.KEY_CODE_PRINT && m == KeyEventConstants.MODIFIER_PRINT) ||
                (c == KeyEventConstants.KEY_CODE_FIT_ACTUAL && m == KeyEventConstants.MODIFIER_FIT_ACTUAL) ||
                (c == KeyEventConstants.KEY_CODE_FIT_PAGE && m == KeyEventConstants.MODIFIER_FIT_PAGE) ||
                (c == KeyEventConstants.KEY_CODE_FIT_WIDTH && m == KeyEventConstants.MODIFIER_FIT_WIDTH) ||
                (c == KeyEventConstants.KEY_CODE_ZOOM_IN && m == KeyEventConstants.MODIFIER_ZOOM_IN) ||
                (c == KeyEventConstants.KEY_CODE_ZOOM_OUT && m == KeyEventConstants.MODIFIER_ZOOM_OUT) ||
                (c == KeyEventConstants.KEY_CODE_ROTATE_LEFT && m == KeyEventConstants.MODIFIER_ROTATE_LEFT) ||
                (c == KeyEventConstants.KEY_CODE_ROTATE_RIGHT && m == KeyEventConstants.MODIFIER_ROTATE_RIGHT) ||
                (c == KeyEventConstants.KEY_CODE_FIRST_PAGE && m == KeyEventConstants.MODIFIER_FIRST_PAGE) ||
                (c == KeyEventConstants.KEY_CODE_PREVIOUS_PAGE && m == KeyEventConstants.MODIFIER_PREVIOUS_PAGE) ||
                (c == KeyEventConstants.KEY_CODE_NEXT_PAGE && m == KeyEventConstants.MODIFIER_NEXT_PAGE) ||
                (c == KeyEventConstants.KEY_CODE_LAST_PAGE && m == KeyEventConstants.MODIFIER_LAST_PAGE) ||
                (c == KeyEventConstants.KEY_CODE_SEARCH && m == KeyEventConstants.MODIFIER_SEARCH) ||
                (c == KeyEventConstants.KEY_CODE_GOTO && m == KeyEventConstants.MODIFIER_GOTO)) {
            // get document previous icon
            int documentIcon = getDocumentViewToolMode();
            try {
                // set cursor for document view
                setDisplayTool(DocumentViewModelImpl.DISPLAY_TOOL_WAIT);

                if (c == KeyEventConstants.KEY_CODE_SAVE_AS &&
                        m == KeyEventConstants.MODIFIER_SAVE_AS) {
                    saveFile();
                } else if (c == KeyEventConstants.KEY_CODE_PRINT_SETUP &&
                        m == KeyEventConstants.MODIFIER_PRINT_SETUP) {
                    showPrintSetupDialog();
                } else if (c == KeyEventConstants.KEY_CODE_PRINT &&
                        m == KeyEventConstants.MODIFIER_PRINT) {
                    print(true);
                } else if (c == KeyEventConstants.KEY_CODE_FIT_ACTUAL &&
                        m == KeyEventConstants.MODIFIER_FIT_ACTUAL) {
                    setPageFitMode(org.icepdf.core.views.DocumentViewController.PAGE_FIT_ACTUAL_SIZE, false);
                } else if (c == KeyEventConstants.KEY_CODE_FIT_PAGE &&
                        m == KeyEventConstants.MODIFIER_FIT_PAGE) {
                    setPageFitMode(org.icepdf.core.views.DocumentViewController.PAGE_FIT_WINDOW_HEIGHT, false);
                } else if (c == KeyEventConstants.KEY_CODE_FIT_WIDTH &&
                        m == KeyEventConstants.MODIFIER_FIT_WIDTH) {
                    setPageFitMode(org.icepdf.core.views.DocumentViewController.PAGE_FIT_WINDOW_WIDTH, false);
                } else if (c == KeyEventConstants.KEY_CODE_ZOOM_IN &&
                        m == KeyEventConstants.MODIFIER_ZOOM_IN) {
                    zoomIn();
                } else if (c == KeyEventConstants.KEY_CODE_ZOOM_OUT &&
                        m == KeyEventConstants.MODIFIER_ZOOM_OUT) {
                    zoomOut();
                } else if (c == KeyEventConstants.KEY_CODE_ROTATE_LEFT &&
                        m == KeyEventConstants.MODIFIER_ROTATE_LEFT) {
                    rotateLeft();
                } else if (c == KeyEventConstants.KEY_CODE_ROTATE_RIGHT &&
                        m == KeyEventConstants.MODIFIER_ROTATE_RIGHT) {
                    rotateRight();
                } else if (c == KeyEventConstants.KEY_CODE_FIRST_PAGE &&
                        m == KeyEventConstants.MODIFIER_FIRST_PAGE) {
                    showPage(0);
                } else if (c == KeyEventConstants.KEY_CODE_PREVIOUS_PAGE &&
                        m == KeyEventConstants.MODIFIER_PREVIOUS_PAGE) {
                    DocumentView documentView = documentViewController.getDocumentView();
                    goToDeltaPage(-documentView.getPreviousPageIncrement());
                } else if (c == KeyEventConstants.KEY_CODE_NEXT_PAGE &&
                        m == KeyEventConstants.MODIFIER_NEXT_PAGE) {
                    DocumentView documentView = documentViewController.getDocumentView();
                    goToDeltaPage(documentView.getNextPageIncrement());
                } else if (c == KeyEventConstants.KEY_CODE_LAST_PAGE &&
                        m == KeyEventConstants.MODIFIER_LAST_PAGE) {
                    showPage(getPageTree().getNumberOfPages() - 1);
                } else if (c == KeyEventConstants.KEY_CODE_SEARCH &&
                        m == KeyEventConstants.MODIFIER_SEARCH) {
                    showSearchPanel();
                } else if (c == KeyEventConstants.KEY_CODE_GOTO &&
                        m == KeyEventConstants.MODIFIER_GOTO) {
                    showPageSelectionDialog();
                }
            } finally {
                // set view pain back to previous icon
                setDisplayTool(documentIcon);
            }
        }
    }