Class PDFDebugger

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.concurrent.Callable<java.lang.Integer>, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.HyperlinkListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class PDFDebugger
    extends javax.swing.JFrame
    implements java.util.concurrent.Callable<java.lang.Integer>, javax.swing.event.HyperlinkListener
    PDF Debugger.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  PDFDebugger.DocumentOpener
      Internal class to avoid double code in password entry loop.
      • Nested classes/interfaces inherited from class javax.swing.JFrame

        javax.swing.JFrame.AccessibleJFrame
      • Nested classes/interfaces inherited from class java.awt.Frame

        java.awt.Frame.AccessibleAWTFrame
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Constructor Summary

      Constructors 
      Constructor Description
      PDFDebugger()
      Constructor.
      PDFDebugger​(java.lang.String initialViewMode)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addRecentFileItems()  
      java.lang.Integer call()  
      private java.lang.String convertToString​(java.lang.Object selectedNode)  
      private javax.swing.JMenu createEditMenu()  
      private javax.swing.JMenu createFileMenu()  
      private javax.swing.JMenu createFindMenu()  
      private void exitMenuItemActionPerformed​(java.awt.event.ActionEvent ignored)  
      javax.swing.JMenu getFindMenu()
      Returns the File menu.
      javax.swing.JMenuItem getFindMenuItem()
      Returns the Edit > Find > Find menu item.
      javax.swing.JMenuItem getFindNextMenuItem()
      Returns the Edit > Find > Find Next menu item.
      javax.swing.JMenuItem getFindPreviousMenuItem()
      Returns the Edit > Find > Find Previous menu item.
      private COSName getNodeKey​(java.lang.Object selectedNode)  
      static java.lang.String getPageLabel​(PDDocument document, int pageIndex)
      Convenience method to get the page label if available.
      java.lang.String getTreeViewMode()
      Provide the current view mode of the tree view.
      private COSBase getUnderneathObject​(java.lang.Object selectedNode)  
      boolean hasDocument()  
      void hyperlinkUpdate​(javax.swing.event.HyperlinkEvent he)  
      private void initComponents()
      This method is called from within the constructor to initialize the form.
      protected void initGlobalEventHandlers()
      Initialize application global event handlers.
      void initTree()  
      private boolean isAnnot​(java.lang.Object obj)  
      private boolean isCIDFont​(COSDictionary dic)  
      private boolean isEncrypt​(java.lang.Object obj)  
      private boolean isFlagNode​(java.lang.Object selectedNode, java.lang.Object parentNode)  
      private boolean isFont​(java.lang.Object selectedNode)  
      private boolean isFontDescriptor​(java.lang.Object obj)  
      private boolean isOtherColorSpace​(java.lang.Object selectedNode)  
      private boolean isPage​(java.lang.Object selectedNode)  
      private boolean isSignature​(java.lang.Object selectedNode, java.lang.Object parentNode)  
      private boolean isSpecialColorSpace​(java.lang.Object selectedNode)  
      private boolean isStream​(java.lang.Object selectedNode)  
      private boolean isString​(java.lang.Object selectedNode)  
      private void jTree1ValueChanged​(javax.swing.event.TreeSelectionEvent evt)  
      private void loadConfiguration()
      Loads the local configuration file, if any.
      static void main​(java.lang.String[] args)
      Entry point.
      private void openMenuItemActionPerformed​(java.awt.event.ActionEvent evt)  
      private void osxOpenFiles​(java.lang.String filename)
      This method is called via reflection on Mac OS X.
      private void osxQuit()
      This method is called via reflection on Mac OS X.
      protected void performApplicationExit()
      Exit the application after the window is closed.
      private void printMenuItemActionPerformed​(java.awt.event.ActionEvent evt)  
      private void readPDFFile​(java.io.File file, java.lang.String password)  
      private void readPDFFile​(java.lang.String filePath, java.lang.String password)  
      private void readPDFurl​(java.lang.String urlString, java.lang.String password)  
      private void replaceRightComponent​(java.awt.Component pane)  
      private void saveAsMenuItemActionPerformed​(java.awt.event.ActionEvent evt)  
      void setTreeViewMode​(java.lang.String viewMode)
      Set the current view mode of the tree view.
      private void showColorPane​(java.lang.Object csNode)
      Show a Panel describing color spaces in more detail and interactive way.
      private void showFlagPane​(java.lang.Object parentNode, java.lang.Object selectedNode)  
      private void showFont​(java.lang.Object selectedNode, javax.swing.tree.TreePath path)  
      private void showPage​(java.lang.Object selectedNode)  
      private void showSignaturePane​(java.lang.Object selectedNode)  
      private void showStream​(COSStream stream, javax.swing.tree.TreePath path)  
      private void showString​(java.lang.Object selectedNode)  
      private void textDialog​(java.lang.String title, java.net.URL resource)  
      • Methods inherited from class javax.swing.JFrame

        addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Frame

        addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.MenuContainer

        getFont, postEvent
    • Field Detail

      • LOG

        private static org.apache.commons.logging.Log LOG
      • SPECIALCOLORSPACES

        private static final java.util.Set<COSName> SPECIALCOLORSPACES
      • OTHERCOLORSPACES

        private static final java.util.Set<COSName> OTHERCOLORSPACES
      • PDF_FILTER

        private static final javax.swing.filechooser.FileFilter PDF_FILTER
      • shortcutKeyMask

        private int shortcutKeyMask
      • OS_NAME

        private static final java.lang.String OS_NAME
      • IS_MAC_OS

        private static final boolean IS_MAC_OS
      • documentPanel

        private final javax.swing.JPanel documentPanel
      • currentFilePath

        private java.lang.String currentFilePath
      • jScrollPaneRight

        private javax.swing.JScrollPane jScrollPaneRight
      • jSplitPane

        private javax.swing.JSplitPane jSplitPane
      • jTextPane

        private javax.swing.JTextPane jTextPane
      • tree

        private Tree tree
      • saveAsMenuItem

        private javax.swing.JMenuItem saveAsMenuItem
      • recentFilesMenu

        private javax.swing.JMenu recentFilesMenu
      • printMenuItem

        private javax.swing.JMenuItem printMenuItem
      • reopenMenuItem

        private javax.swing.JMenuItem reopenMenuItem
      • findMenu

        private javax.swing.JMenu findMenu
      • findMenuItem

        private javax.swing.JMenuItem findMenuItem
      • findNextMenuItem

        private javax.swing.JMenuItem findNextMenuItem
      • findPreviousMenuItem

        private javax.swing.JMenuItem findPreviousMenuItem
      • currentTreeViewMode

        private java.lang.String currentTreeViewMode
      • SYSERR

        private final java.io.PrintStream SYSERR
      • usageHelpRequested

        boolean usageHelpRequested
      • password

        private java.lang.String password
      • viewstructure

        private boolean viewstructure
      • infile

        private java.io.File infile
      • configuration

        public static final java.util.Properties configuration
      • spec

        picocli.CommandLine.Model.CommandSpec spec
    • Constructor Detail

      • PDFDebugger

        public PDFDebugger()
        Constructor.
      • PDFDebugger

        public PDFDebugger​(java.lang.String initialViewMode)
        Constructor.
        Parameters:
        initialViewMode - initial view mode for the tree view on the left hand side.
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Entry point.
        Parameters:
        args - the command line arguments
      • call

        public java.lang.Integer call()
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.Integer>
      • getTreeViewMode

        public java.lang.String getTreeViewMode()
        Provide the current view mode of the tree view. see TreeViewMenu for valid values
      • setTreeViewMode

        public void setTreeViewMode​(java.lang.String viewMode)
        Set the current view mode of the tree view. see TreeViewMenu for valid values
        Parameters:
        viewMode - the view mode to be set
      • hasDocument

        public boolean hasDocument()
      • loadConfiguration

        private void loadConfiguration()
        Loads the local configuration file, if any.
      • initComponents

        private void initComponents()
        This method is called from within the constructor to initialize the form.
      • initGlobalEventHandlers

        protected void initGlobalEventHandlers()
        Initialize application global event handlers. Protected to allow subclasses to override this method if they don't want the global event handler overridden.
      • createFileMenu

        private javax.swing.JMenu createFileMenu()
      • createEditMenu

        private javax.swing.JMenu createEditMenu()
      • createFindMenu

        private javax.swing.JMenu createFindMenu()
      • getFindMenu

        public javax.swing.JMenu getFindMenu()
        Returns the File menu.
        Returns:
        the File menu
      • getFindMenuItem

        public javax.swing.JMenuItem getFindMenuItem()
        Returns the Edit > Find > Find menu item.
        Returns:
        the Find menu
      • getFindNextMenuItem

        public javax.swing.JMenuItem getFindNextMenuItem()
        Returns the Edit > Find > Find Next menu item.
        Returns:
        the FindNext menu
      • getFindPreviousMenuItem

        public javax.swing.JMenuItem getFindPreviousMenuItem()
        Returns the Edit > Find > Find Previous menu item.
        Returns:
        the FindPrevious menu
      • osxOpenFiles

        private void osxOpenFiles​(java.lang.String filename)
        This method is called via reflection on Mac OS X.
      • osxQuit

        private void osxQuit()
        This method is called via reflection on Mac OS X.
      • saveAsMenuItemActionPerformed

        private void saveAsMenuItemActionPerformed​(java.awt.event.ActionEvent evt)
      • openMenuItemActionPerformed

        private void openMenuItemActionPerformed​(java.awt.event.ActionEvent evt)
      • jTree1ValueChanged

        private void jTree1ValueChanged​(javax.swing.event.TreeSelectionEvent evt)
      • showSignaturePane

        private void showSignaturePane​(java.lang.Object selectedNode)
      • isSignature

        private boolean isSignature​(java.lang.Object selectedNode,
                                    java.lang.Object parentNode)
      • isSpecialColorSpace

        private boolean isSpecialColorSpace​(java.lang.Object selectedNode)
      • isOtherColorSpace

        private boolean isOtherColorSpace​(java.lang.Object selectedNode)
      • isPage

        private boolean isPage​(java.lang.Object selectedNode)
      • isFlagNode

        private boolean isFlagNode​(java.lang.Object selectedNode,
                                   java.lang.Object parentNode)
      • isEncrypt

        private boolean isEncrypt​(java.lang.Object obj)
      • isFontDescriptor

        private boolean isFontDescriptor​(java.lang.Object obj)
      • isAnnot

        private boolean isAnnot​(java.lang.Object obj)
      • isStream

        private boolean isStream​(java.lang.Object selectedNode)
      • isString

        private boolean isString​(java.lang.Object selectedNode)
      • isFont

        private boolean isFont​(java.lang.Object selectedNode)
      • showColorPane

        private void showColorPane​(java.lang.Object csNode)
                            throws java.io.IOException
        Show a Panel describing color spaces in more detail and interactive way.
        Parameters:
        csNode - the special color space containing node.
        Throws:
        java.io.IOException
      • showPage

        private void showPage​(java.lang.Object selectedNode)
      • showFlagPane

        private void showFlagPane​(java.lang.Object parentNode,
                                  java.lang.Object selectedNode)
      • showStream

        private void showStream​(COSStream stream,
                                javax.swing.tree.TreePath path)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • showFont

        private void showFont​(java.lang.Object selectedNode,
                              javax.swing.tree.TreePath path)
      • replaceRightComponent

        private void replaceRightComponent​(java.awt.Component pane)
      • showString

        private void showString​(java.lang.Object selectedNode)
      • getNodeKey

        private COSName getNodeKey​(java.lang.Object selectedNode)
      • getUnderneathObject

        private COSBase getUnderneathObject​(java.lang.Object selectedNode)
      • convertToString

        private java.lang.String convertToString​(java.lang.Object selectedNode)
      • exitMenuItemActionPerformed

        private void exitMenuItemActionPerformed​(java.awt.event.ActionEvent ignored)
      • performApplicationExit

        protected void performApplicationExit()
        Exit the application after the window is closed. This is protected to let subclasses override the behavior.
      • printMenuItemActionPerformed

        private void printMenuItemActionPerformed​(java.awt.event.ActionEvent evt)
      • readPDFFile

        private void readPDFFile​(java.lang.String filePath,
                                 java.lang.String password)
                          throws java.io.IOException,
                                 java.net.URISyntaxException
        Throws:
        java.io.IOException
        java.net.URISyntaxException
      • readPDFFile

        private void readPDFFile​(java.io.File file,
                                 java.lang.String password)
                          throws java.io.IOException,
                                 java.net.URISyntaxException
        Throws:
        java.io.IOException
        java.net.URISyntaxException
      • readPDFurl

        private void readPDFurl​(java.lang.String urlString,
                                java.lang.String password)
                         throws java.io.IOException,
                                java.net.URISyntaxException
        Throws:
        java.io.IOException
        java.net.URISyntaxException
      • initTree

        public void initTree()
      • addRecentFileItems

        private void addRecentFileItems()
      • getPageLabel

        public static java.lang.String getPageLabel​(PDDocument document,
                                                    int pageIndex)
        Convenience method to get the page label if available.
        Parameters:
        document - the current document
        pageIndex - 0-based page number.
        Returns:
        a page label or null if not available.
      • textDialog

        private void textDialog​(java.lang.String title,
                                java.net.URL resource)
      • hyperlinkUpdate

        public void hyperlinkUpdate​(javax.swing.event.HyperlinkEvent he)
        Specified by:
        hyperlinkUpdate in interface javax.swing.event.HyperlinkListener