* @param pathOrURL   Either a file path, or file name, or URL, describing the
     *                    origin of the PDF file. This is typically null. If non-null, it is
     *                    used to populate the default file name in the File..Save a Copy
     *                    dialog summoned in saveFile()
     */
    public void openDocument(byte[] data, int offset, int length, String description, String pathOrURL) {
        if (data != null) {
            try {
                // dispose a currently open document, if one.
                if (document != null) {
                    closeDocument();
                }

                setDisplayTool(DocumentViewModelImpl.DISPLAY_TOOL_WAIT);

                // load the document
                document = new Document();
                // create default security callback is user has not created one
                if (documentViewController.getSecurityCallback() == null) {
                    document.setSecurityCallback(
                            new MyGUISecurityCallback(viewer, messageBundle));
                }
                document.setByteArray(data, offset, length, pathOrURL);

                commonNewDocumentHandling(description);
            } catch (PDFException e) {
                org.icepdf.ri.util.Resources.showMessageDialog(
                        viewer,
                        JOptionPane.INFORMATION_MESSAGE,
                        messageBundle,
                        "viewer.dialog.openDocument.pdfException.title",
                        "viewer.dialog.openDocument.pdfException.msg",
                        description);
                document = null;
                logger.log(Level.FINE, "Error opening document.", e);
            } catch (PDFSecurityException e) {
                org.icepdf.ri.util.Resources.showMessageDialog(
                        viewer,
                        JOptionPane.INFORMATION_MESSAGE,
                        messageBundle,
                        "viewer.dialog.openDocument.pdfSecurityException.title",
                        "viewer.dialog.openDocument.pdfSecurityException.msg",
                        description);
                document = null;
                logger.log(Level.FINE, "Error opening document.", e);
            } catch (Exception e) {
                org.icepdf.ri.util.Resources.showMessageDialog(
                        viewer,
                        JOptionPane.INFORMATION_MESSAGE,
                        messageBundle,
                        "viewer.dialog.openDocument.exception.title",
                        "viewer.dialog.openDocument.exception.msg",
                        description);
                document = null;
                logger.log(Level.FINE, "Error opening document.", e);
            } finally {
                setDisplayTool(DocumentViewModelImpl.DISPLAY_TOOL_PAN);
            }
        }
    }