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,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.HyperlinkListenerPDF Debugger.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPDFDebugger.DocumentOpenerInternal 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 java.util.Propertiesconfigurationprivate java.lang.StringcurrentFilePathprivate java.lang.StringcurrentTreeViewModeprivate PDDocumentdocumentprivate javax.swing.JPaneldocumentPanelprivate javax.swing.JMenufindMenuprivate javax.swing.JMenuItemfindMenuItemprivate javax.swing.JMenuItemfindNextMenuItemprivate javax.swing.JMenuItemfindPreviousMenuItemprivate java.io.Fileinfileprivate static booleanIS_MAC_OSprivate javax.swing.JScrollPanejScrollPaneRightprivate javax.swing.JSplitPanejSplitPaneprivate javax.swing.JTextPanejTextPaneprivate static org.apache.commons.logging.LogLOGprivate static java.lang.StringOS_NAMEprivate static java.util.Set<COSName>OTHERCOLORSPACESprivate java.lang.Stringpasswordprivate static javax.swing.filechooser.FileFilterPDF_FILTERprivate javax.swing.JMenuItemprintMenuItemprivate RecentFilesrecentFilesprivate javax.swing.JMenurecentFilesMenuprivate javax.swing.JMenuItemreopenMenuItemprivate javax.swing.JMenuItemsaveAsMenuItemprivate intshortcutKeyMask(package private) picocli.CommandLine.Model.CommandSpecspecprivate static java.util.Set<COSName>SPECIALCOLORSPACESprivate ReaderBottomPanelstatusBarprivate TreeStatusPanestatusPaneprivate java.io.PrintStreamSYSERRprivate Treetree(package private) booleanusageHelpRequestedprivate booleanviewstructureprivate WindowPrefswindowPrefs-
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
-
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(java.lang.String initialViewMode)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddRecentFileItems()java.lang.Integercall()private java.lang.StringconvertToString(java.lang.Object selectedNode)private javax.swing.JMenucreateEditMenu()private javax.swing.JMenucreateFileMenu()private javax.swing.JMenucreateFindMenu()private voidexitMenuItemActionPerformed(java.awt.event.ActionEvent ignored)javax.swing.JMenugetFindMenu()Returns the File menu.javax.swing.JMenuItemgetFindMenuItem()Returns the Edit > Find > Find menu item.javax.swing.JMenuItemgetFindNextMenuItem()Returns the Edit > Find > Find Next menu item.javax.swing.JMenuItemgetFindPreviousMenuItem()Returns the Edit > Find > Find Previous menu item.private COSNamegetNodeKey(java.lang.Object selectedNode)static java.lang.StringgetPageLabel(PDDocument document, int pageIndex)Convenience method to get the page label if available.java.lang.StringgetTreeViewMode()Provide the current view mode of the tree view.private COSBasegetUnderneathObject(java.lang.Object selectedNode)booleanhasDocument()voidhyperlinkUpdate(javax.swing.event.HyperlinkEvent he)private voidinitComponents()This method is called from within the constructor to initialize the form.protected voidinitGlobalEventHandlers()Initialize application global event handlers.voidinitTree()private booleanisAnnot(java.lang.Object obj)private booleanisCIDFont(COSDictionary dic)private booleanisEncrypt(java.lang.Object obj)private booleanisFlagNode(java.lang.Object selectedNode, java.lang.Object parentNode)private booleanisFont(java.lang.Object selectedNode)private booleanisFontDescriptor(java.lang.Object obj)private booleanisOtherColorSpace(java.lang.Object selectedNode)private booleanisPage(java.lang.Object selectedNode)private booleanisSignature(java.lang.Object selectedNode, java.lang.Object parentNode)private booleanisSpecialColorSpace(java.lang.Object selectedNode)private booleanisStream(java.lang.Object selectedNode)private booleanisString(java.lang.Object selectedNode)private voidjTree1ValueChanged(javax.swing.event.TreeSelectionEvent evt)private voidloadConfiguration()Loads the local configuration file, if any.static voidmain(java.lang.String[] args)Entry point.private voidopenMenuItemActionPerformed(java.awt.event.ActionEvent evt)private voidosxOpenFiles(java.lang.String filename)This method is called via reflection on Mac OS X.private voidosxQuit()This method is called via reflection on Mac OS X.protected voidperformApplicationExit()Exit the application after the window is closed.private voidprintMenuItemActionPerformed(java.awt.event.ActionEvent evt)private voidreadPDFFile(java.io.File file, java.lang.String password)private voidreadPDFFile(java.lang.String filePath, java.lang.String password)private voidreadPDFurl(java.lang.String urlString, java.lang.String password)private voidreplaceRightComponent(java.awt.Component pane)private voidsaveAsMenuItemActionPerformed(java.awt.event.ActionEvent evt)voidsetTreeViewMode(java.lang.String viewMode)Set the current view mode of the tree view.private voidshowColorPane(java.lang.Object csNode)Show a Panel describing color spaces in more detail and interactive way.private voidshowFlagPane(java.lang.Object parentNode, java.lang.Object selectedNode)private voidshowFont(java.lang.Object selectedNode, javax.swing.tree.TreePath path)private voidshowPage(java.lang.Object selectedNode)private voidshowSignaturePane(java.lang.Object selectedNode)private voidshowStream(COSStream stream, javax.swing.tree.TreePath path)private voidshowString(java.lang.Object selectedNode)private voidtextDialog(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
-
-
-
-
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
-
statusPane
private TreeStatusPane statusPane
-
recentFiles
private RecentFiles recentFiles
-
windowPrefs
private WindowPrefs windowPrefs
-
document
private PDDocument document
-
currentFilePath
private java.lang.String currentFilePath
-
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
-
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
-
-
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:
callin interfacejava.util.concurrent.Callable<java.lang.Integer>
-
getTreeViewMode
public java.lang.String getTreeViewMode()
Provide the current view mode of the tree view. seeTreeViewMenufor valid values
-
setTreeViewMode
public void setTreeViewMode(java.lang.String viewMode)
Set the current view mode of the tree view. seeTreeViewMenufor 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)
-
isCIDFont
private boolean isCIDFont(COSDictionary dic)
-
showColorPane
private void showColorPane(java.lang.Object csNode) throws java.io.IOExceptionShow 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.IOExceptionjava.net.URISyntaxException
-
readPDFFile
private void readPDFFile(java.io.File file, java.lang.String password) throws java.io.IOException, java.net.URISyntaxException- Throws:
java.io.IOExceptionjava.net.URISyntaxException
-
readPDFurl
private void readPDFurl(java.lang.String urlString, java.lang.String password) throws java.io.IOException, java.net.URISyntaxException- Throws:
java.io.IOExceptionjava.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 documentpageIndex- 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:
hyperlinkUpdatein interfacejavax.swing.event.HyperlinkListener
-
-