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.JFramePDF 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 javax.swing.JCheckBoxMenuItemallowSubsamplingstatic java.util.Propertiesconfigurationprivate java.lang.StringcurrentFilePathprivate PDDocumentdocumentprivate javax.swing.JPaneldocumentPanelprivate javax.swing.JMenufindMenuprivate javax.swing.JMenuItemfindMenuItemprivate javax.swing.JMenuItemfindNextMenuItemprivate javax.swing.JMenuItemfindPreviousMenuItemprivate static booleanIS_MAC_OSprivate booleanisPageModeprivate 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 static java.lang.StringPASSWORDprivate static javax.swing.filechooser.FileFilterPDF_FILTERprivate javax.swing.JMenuprintDpiMenuprivate javax.swing.JMenuItemprintMenuItemprivate RecentFilesrecentFilesprivate javax.swing.JMenurecentFilesMenuprivate javax.swing.JMenuItemreopenMenuItemstatic javax.swing.JCheckBoxMenuItemrepairAcroFormMenuItemprivate javax.swing.JMenuItemsaveAsMenuItemprivate static intSHORCUT_KEY_MASKprivate static java.util.Set<COSName>SPECIALCOLORSPACESprivate ReaderBottomPanelstatusBarprivate TreeStatusPanestatusPaneprivate Treetreeprivate static java.lang.StringVIEW_STRUCTUREprivate javax.swing.JMenuItemviewModeItemprivate WindowPrefswindowPrefs-
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 voidaddRecentFileItems()private java.lang.StringconvertToString(java.lang.Object selectedNode)private javax.swing.JMenucreateEditMenu()private javax.swing.JMenucreateFileMenu()private javax.swing.JMenucreateFindMenu()private javax.swing.JMenucreateViewMenu()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.private java.lang.ObjectgetUnderneathObject(java.lang.Object selectedNode)private voidinitComponents()This method is called from within the constructor to initialize the form.protected voidinitGlobalEventHandlers()Initialize application global event handlers.private 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 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)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 voidshowStream(COSStream stream, javax.swing.tree.TreePath path)private voidshowString(java.lang.Object selectedNode)private static voidusage()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
-
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
-
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
-
recentFilesMenu
private javax.swing.JMenu recentFilesMenu
-
printMenuItem
private javax.swing.JMenuItem printMenuItem
-
printDpiMenu
private javax.swing.JMenu printDpiMenu
-
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
-
configuration
public static final java.util.Properties configuration
-
-
Method Detail
-
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()
-
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.
-
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)
-
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 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.ExceptionEntry 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.
-
-