Package org.apache.pdfbox.debugger
Class PDFDebugger
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- org.apache.pdfbox.debugger.PDFDebugger
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class PDFDebugger extends javax.swing.JFrame
PDF Debugger.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) 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.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description static javax.swing.JCheckBoxMenuItem
allowSubsampling
private java.lang.String
currentFilePath
private PDDocument
document
private javax.swing.JPanel
documentPanel
private javax.swing.JMenu
findMenu
private javax.swing.JMenuItem
findMenuItem
private javax.swing.JMenuItem
findNextMenuItem
private javax.swing.JMenuItem
findPreviousMenuItem
private static boolean
IS_MAC_OS
private boolean
isPageMode
private javax.swing.JScrollPane
jScrollPaneRight
private javax.swing.JSplitPane
jSplitPane
private javax.swing.JTextPane
jTextPane
private static java.lang.String
OS_NAME
private static java.util.Set<COSName>
OTHERCOLORSPACES
private static java.lang.String
PASSWORD
private javax.swing.JMenuItem
printMenuItem
private RecentFiles
recentFiles
private javax.swing.JMenu
recentFilesMenu
private javax.swing.JMenuItem
reopenMenuItem
static javax.swing.JCheckBoxMenuItem
repairAcroFormMenuItem
private javax.swing.JMenuItem
saveAsMenuItem
private javax.swing.JMenuItem
saveMenuItem
private static int
SHORCUT_KEY_MASK
private static java.util.Set<COSName>
SPECIALCOLORSPACES
private ReaderBottomPanel
statusBar
private TreeStatusPane
statusPane
private Tree
tree
private static java.lang.String
VIEW_STRUCTURE
private javax.swing.JMenuItem
viewModeItem
private WindowPrefs
windowPrefs
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description PDFDebugger()
Constructor.PDFDebugger(boolean viewPages)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addRecentFileItems()
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 javax.swing.JMenu
createViewMenu()
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.private java.lang.Object
getUnderneathObject(java.lang.Object selectedNode)
private void
initComponents()
This method is called from within the constructor to initialize the form.protected void
initGlobalEventHandlers()
Initialize application global event handlers.private 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
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)
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
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
showStream(COSStream stream, javax.swing.tree.TreePath path)
private void
showString(java.lang.Object selectedNode)
private static void
usage()
This will print out a message telling how to use this utility.-
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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
SPECIALCOLORSPACES
private static final java.util.Set<COSName> SPECIALCOLORSPACES
-
OTHERCOLORSPACES
private static final java.util.Set<COSName> OTHERCOLORSPACES
-
PASSWORD
private static final java.lang.String PASSWORD
- See Also:
- Constant Field Values
-
VIEW_STRUCTURE
private static final java.lang.String VIEW_STRUCTURE
- See Also:
- Constant Field Values
-
SHORCUT_KEY_MASK
private static final int SHORCUT_KEY_MASK
-
statusPane
private TreeStatusPane statusPane
-
recentFiles
private RecentFiles recentFiles
-
windowPrefs
private WindowPrefs windowPrefs
-
isPageMode
private boolean isPageMode
-
document
private PDDocument document
-
currentFilePath
private java.lang.String currentFilePath
-
OS_NAME
private static final java.lang.String OS_NAME
-
IS_MAC_OS
private static final boolean IS_MAC_OS
-
jScrollPaneRight
private javax.swing.JScrollPane jScrollPaneRight
-
jSplitPane
private javax.swing.JSplitPane jSplitPane
-
jTextPane
private javax.swing.JTextPane jTextPane
-
statusBar
private ReaderBottomPanel statusBar
-
tree
private Tree tree
-
documentPanel
private final javax.swing.JPanel documentPanel
-
saveAsMenuItem
private javax.swing.JMenuItem saveAsMenuItem
-
saveMenuItem
private javax.swing.JMenuItem saveMenuItem
-
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
-
viewModeItem
private javax.swing.JMenuItem viewModeItem
-
allowSubsampling
public static javax.swing.JCheckBoxMenuItem allowSubsampling
-
repairAcroFormMenuItem
public static javax.swing.JCheckBoxMenuItem repairAcroFormMenuItem
-
-
Method Detail
-
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()
-
createViewMenu
private javax.swing.JMenu createViewMenu()
-
createFindMenu
private javax.swing.JMenu createFindMenu()
-
getFindMenu
public javax.swing.JMenu getFindMenu()
Returns the File menu.
-
getFindMenuItem
public javax.swing.JMenuItem getFindMenuItem()
Returns the Edit > Find > Find menu item.
-
getFindNextMenuItem
public javax.swing.JMenuItem getFindNextMenuItem()
Returns the Edit > Find > Find Next menu item.
-
getFindPreviousMenuItem
public javax.swing.JMenuItem getFindPreviousMenuItem()
Returns the Edit > Find > Find Previous menu item.
-
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.
-
openMenuItemActionPerformed
private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt)
-
jTree1ValueChanged
private void jTree1ValueChanged(javax.swing.event.TreeSelectionEvent evt)
-
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)
-
isCIDFont
private boolean isCIDFont(COSDictionary dic)
-
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 java.lang.Object 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)
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
Entry point.- Parameters:
args
- the command line arguments- Throws:
java.lang.Exception
- If anything goes wrong.
-
readPDFFile
private void readPDFFile(java.lang.String filePath, java.lang.String password) throws java.io.IOException
- Throws:
java.io.IOException
-
readPDFFile
private void readPDFFile(java.io.File file, java.lang.String password) throws java.io.IOException
- Throws:
java.io.IOException
-
readPDFurl
private void readPDFurl(java.lang.String urlString, java.lang.String password) throws java.io.IOException
- Throws:
java.io.IOException
-
initTree
private void initTree()
-
addRecentFileItems
private void addRecentFileItems()
-
usage
private static void usage()
This will print out a message telling how to use this utility.
-
getPageLabel
public static java.lang.String getPageLabel(PDDocument document, int pageIndex)
Convenience method to get the page label if available.- Parameters:
document
-pageIndex
- 0-based page number.- Returns:
- a page label or null if not available.
-
-