org.faceless.pdf2.viewer2

## Class DocumentPanel

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - org.faceless.pdf2.viewer2.DocumentPanel

- All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible

      public class DocumentPanel
      extends JPanel

  A `DocumentPanel` is the basic component that displays a PDF, and may be instantiated on it's own or as part of a `PDFViewer`. It contains a `DocumentViewport` and optionally one or more `SidePanel` objects on the left, and may process `PDFAction`s on the PDF. See the viewer tutorial for more detail on how to use this class and the "viewer" package.

  The following initialization parameters may be specified

  defaultViewport | The class name of the default viewport to use if not specified in the PDF. May be `SinglePageDocumentViewport`, `MultiPageDocumentVieport` or a fully-qualified class name of another `DocumentViewport`
  defaultPageMode | The default "page mode" of the PDF if not set. This may take one of the values for the "pagemode" `PDF option`, and would typically be "UseThumbs" or "UseOutlines".
  defaultZoom | The default zoom level of the PDF, if not set by a PDF open action. This may be the value "fit", "fitwidth", "fitheight" or a number between 12.5 and 6400 to set the zoom level.
  useNamedSidePanels | `true` or `false` (the default) - whether to show names on the side panel tabs rather than icons.
  sidePanelSize | The default (and minimum) width of the side panels displayed in this DocumentPanel. The default is 120
  mouseWheelUnit | The number of pixels to adjust the viewport's scrollbar by when using the mouse wheel. The default is 16.
  smoothScrollTime | When smoothly scrolling a viewport's scrollbars, the number of ms to animate the scroll over. The default is 500, set to zero to disable.
  smoothScrollDistance | When smoothly scrolling a viewport's scrollbars, the maximum number of pixels to try to animate. The default is 500, set to zero to disable.
  earlyClose | When closing a DocumentPanel or changing the PDF it contains, the old PDF object remains open and will naturally have its `PDF.close()` method called during garbage collection. This can lead to problems on Windows platforms; As the PDF may retain a reference to the file it was read from, this prevents the file being deleted until `close` is called. The `earlyClose` parameter can be set to close the PDF file immediately the PDF is removed from the DocumentPanel or the panel closed; this will free any resources held by the PDF, and so invalidate any reference to those resources (which may be held elsewhere - for example, if the PDF had its pages moved to another document). So use with caution - by default this value is not set, but set to any non-null value to enable.
  noDirtyDocuments | Set this value to non-null to disable the `dirty` flag on documents. If disabled, no prompt will appear when trying to close a document that has been modified.
  noDirtyInTitle | Set this value to non-null to disable the "*" in the window title when the PDF is flagged as dirty.
  noProgressInTitle | Set this value to non-null to disable the load-progress indicator in the window title when the PDF is linearized and only partially loaded.
  respectSignatureCertification | If true, any restrictions found on a `certified` signature in the PDF will be honoured - for example, if the PDF being displayed has `nochanges` set then no changes will be allowed to the PDF through the viewer
  viewportBorderColor | Can be set to the Color to draw the border around the pages in the viewport, specified as a hex value. The default value is "666666", which is a dark gray. If the specified value has 8 digits, the first two hex digits are used as the alpha value. A value of "none" or "transparent" will not draw the border.
  viewportShadowColor | Can be set to the Color to draw the shadow below the pages in the viewport, specified as a hex value. The default value is "80666666", which is a translucent dark gray. If the specified value has 8 digits, the first two hex digits are used as the alpha value. A value of "none" or "transparent" will not draw the shadow.
  viewportMargin | If set, this is the margin to place around the outside of all the pages displayed in the viewport, in pixels. The default value is 4.
  viewportGap | If set, this is the gap to place between multiple pages displayed in the viewport, in pixels (if applicable to the type of viewport in use). The default value is 10.
  printDialog | This can be set to `native` to always use the native print dialog, `java` to always use the Java dialog, or `auto` to choose depending on which print options are set. The native dialog does not allow options (such as number of copies, duplex printing) to be initialized, and some PDFs can specify defaults for these with the `setOption` mechanism. And the alternative java dialog may miss some advanced options, such as options for stapling the printed document. So a value of `auto` will use the native dialog unless the PDF (or the call to `print` specifies initial value for some of these options.

  This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.

  Since:
    2.8
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JPanel

      `JPanel.AccessibleJPanel`

    - ### Nested classes/interfaces inherited from class javax.swing.JComponent

      `JComponent.AccessibleJComponent`

    - ### Nested classes/interfaces inherited from class java.awt.Container

      `Container.AccessibleAWTContainer`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

  - ### Field Summary

    - ### Fields inherited from class javax.swing.JComponent

      `listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

    - ### Fields inherited from class java.awt.Component

      `accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DocumentPanel()` Create a new DocumentPanel

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addActionHandler(ActionHandler actionhandler)` Add a `ActionHandler` to this `DocumentPanel`.
    `void` | `addAnnotationComponentFactory(AnnotationComponentFactory annotationfactory)` Add a `AnnotationComponentFactory` to this `DocumentPanel`.
    `void` | `addDocumentPanelListener(DocumentPanelListener listener)` Add a `DocumentPanelListener` to this DocumentPanel
    `void` | `addSidePanel(SidePanel panel)` Add the specified sidepanel to the DocumentPanel
    `void` | `addSidePanelFactory(SidePanelFactory panelfactory)` Add a `SidePanelFactory` to this `DocumentPanel`.
    `void` | `addUndoableEditListener(UndoableEditListener l)` Add an `UndoableEditListener` to this DocumentPanel
    `void` | `fireUndoableEditEvent(UndoableEditEvent e)` Fire an `UndoableEditEvent` on this DocumentPanel.
    `File` | `getAssociatedFile()` Get the associated File from this DocumentPanel.
    `DocumentPanelListener[]` | `getDocumentPanelListeners()` Return a list of all the `DocumentPanelListener` objects registered on this DocumentPanel, or an empty array if there are none
    `JSManager` | `getJSManager()` Return the JSManager object for this DocumentPanel.
    `LinearizedSupport` | `getLinearizedSupport()` Return the LinearizedSupport object for this DocumentPanel
    `PDFPage` | `getPage()` Return the PDFPage currently being displayed by the `DocumentViewport`.
    `int` | `getPageNumber()` Return the pagenumber of the currently displayed page starting at 0, or -1 if no page is being displayed.
    `PDFParser` | `getParser()` Get the PDFParser being used to parse this PDF.
    `PDF` | `getPDF()` Return the PDF currently being displayed by this `DocumentPanel`
    `SidePanel` | `getSelectedSidePanel()` Return the currently selected `SidePanel`, or `null` if no panels are displayed.
    `Collection<SidePanel>` | `getSidePanels()` Return a read-only collection containing the `SidePanel` objects in use by this `DocumentPanel`.
    `PDFViewer` | `getViewer()` Return the `PDFViewer` that contains this DocumentPanel.
    `DocumentViewport` | `getViewport()` Return the `DocumentViewport` contained by this DocumentPanel
    `String` | `getWindowTitle()` Get the base title of the window containing this DocumentPanel, which does not include any "*" or loading progress details.
    `float` | `getZoom()` Return the current zoom level.
    `boolean` | `hasPermission(String permission)` Indicates whether the specified type of action is allowed for this DocumentPanel.
    `boolean` | `isDirty()` Return the value of the dirty flag, as set by `setDirty(boolean)`
    `void` | `print(PrintService fservice, PrintRequestAttributeSet fatts)` Display a Print dialog for printing this document, or if a `PrintService` is specified, print directly to that service without displaying a dialog.
    `void` | `raiseDocumentPanelEvent(DocumentPanelEvent event)` Raise a `DocumentPanelEvent` on the DocumentPanel.
    `void` | `redraw(Object o)` Deprecated. DocumentPanel.redraw() is no longer required as this object now listens to `PropertyChangeEvents` fired by the PDF. This method is not called anywhere and is a no-op
    `void` | `removeDocumentPanelListener(DocumentPanelListener listener)` Remove a `DocumentPanelListener` from this DocumentPanel
    `void` | `removeSidePanel(SidePanel panel)` Remove the specified SidePanel from the DocumentPanel.
    `void` | `removeUndoableEditListener(UndoableEditListener l)` Remove an `UndoableEditListener` from this DocumentPanel
    `boolean` | `runAction(PDFAction action)` Run the specified action on the PDF.
    `void` | `setAssociatedFile(File file)` Set the associated File on this DocumentPanel.
    `void` | `setDirty(boolean dirty)` Set the document as being "dirty", ie that it has been modified since loading.
    `void` | `setJSManager(JSManager jsmanager)` Set the JSManager object for this DocumentPanel.
    `void` | `setPage(PDFPage page)` Set the page to display in the `DocumentViewport`.
    `void` | `setPage(PDFPage page, float x, float y, float zoom)` Set the page to display in the `DocumentViewport`.
    `void` | `setPageNumber(int i)` Set the page being displayed.
    `void` | `setPDF(PDF pdf)` Set the PDF to be displayed by this `DocumentPanel`.
    `void` | `setPDF(PDFParser parser, PDFPage page)` Set the PDF to be displayed by this `DocumentPanel`, and specify the initial page to display and the exact `PDFParser` to use.
    `void` | `setPDF(PDF pdf, PDFPage page)` Set the PDF to be displayed by this `DocumentPanel`, and specify the initial page to display.
    `void` | `setPermission(String permission, boolean enable)` Sets whether the specified permission is allowed on this DocumentPanel.
    `void` | `setSelectedSidePanel(SidePanel panel)` Set the currently displayed `SidePanel`.
    `void` | `setSidePanelSize(int threshold, int preferred)` Control the size of the leftmost pane.
    `void` | `setSignaturePermissionRestrictions(FormSignature sig)` Limit the permissions that can be `set` on this PDF to ensure they don't conflict with the `certification` of this signature.
    `void` | `setViewport(DocumentViewport viewport)` Set the `DocumentViewport` used by this DocumentPanel.
    `void` | `setWindowTitle(String title)` Set the base title of the window containing this DocumentPanel
    `void` | `setZoom(float zoom)` Set the current zoom level

    - ### Methods inherited from class javax.swing.JPanel

      `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

    - ### Methods inherited from class javax.swing.JComponent

      `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DocumentPanel

          public DocumentPanel()

      Create a new DocumentPanel

  - ### Method Detail

    - #### setViewport

          public void setViewport(DocumentViewport viewport)

      Set the `DocumentViewport` used by this DocumentPanel.
      Parameters:
        `viewport` - the Viewport

    - #### getViewport

          public DocumentViewport getViewport()

      Return the `DocumentViewport` contained by this DocumentPanel

    - #### getJSManager

          public JSManager getJSManager()

      Return the JSManager object for this DocumentPanel.
      Since:
        2.9

    - #### setJSManager

          public void setJSManager(JSManager jsmanager)

      Set the JSManager object for this DocumentPanel. This method should only be called if multiple DocumentPanel object are used in the same non-PDFViewer container.
      Since:
        2.9

    - #### getViewer

          public PDFViewer getViewer()

      Return the `PDFViewer` that contains this DocumentPanel. Note a DocumentPanel does not have to be contained inside a PDFViewer, in which case this method will return `null`.

    - #### setSidePanelSize

          public void setSidePanelSize(int threshold,
                                       int preferred)

      Control the size of the leftmost pane. The two values specify the threshold below which the pane is considered to be closed, and the default size of the pane when it's opened.
      Parameters:
        `threshold` - the minimum size, below which the panel is assumed to be closed
        `preferred` - the default size of the leftmost pane when opened

    - #### addSidePanelFactory

          public void addSidePanelFactory(SidePanelFactory panelfactory)

      Add a `SidePanelFactory` to this `DocumentPanel`. When a PDF is set, the panels that are appropriate for that PDF will be created from this list of factories.
      Parameters:
        `panelfactory` - the factory

    - #### addAnnotationComponentFactory

          public void addAnnotationComponentFactory(AnnotationComponentFactory annotationfactory)

      Add a `AnnotationComponentFactory` to this `DocumentPanel`. Any PDF's displayed by this panel will have annotations created by these factories.
      Parameters:
        `annotationfactory` - the factory

    - #### addActionHandler

          public void addActionHandler(ActionHandler actionhandler)

      Add a `ActionHandler` to this `DocumentPanel`. Any actions passed to `runAction(org.faceless.pdf2.PDFAction)` will by handled by this list of handlers.
      Parameters:
        `actionhandler` - the handler

    - #### runAction

          public boolean runAction(PDFAction action)

      Run the specified action on the PDF. Actions are handled by `ActionHandler`s, which should be registered with this class via the `addActionHandler()` method.
      Parameters:
        `action` - the PDFAction to run.
      Returns:
        true if the action was recognised and run successfully, false otherwise.

    - #### addDocumentPanelListener

          public void addDocumentPanelListener(DocumentPanelListener listener)

      Add a `DocumentPanelListener` to this DocumentPanel
      Parameters:
        `listener` - the listener

    - #### removeDocumentPanelListener

          public void removeDocumentPanelListener(DocumentPanelListener listener)

      Remove a `DocumentPanelListener` from this DocumentPanel
      Parameters:
        `listener` - the listener

    - #### getDocumentPanelListeners

          public DocumentPanelListener[] getDocumentPanelListeners()

      Return a list of all the `DocumentPanelListener` objects registered on this DocumentPanel, or an empty array if there are none
      Returns:
        the list of listeners
      Since:
        2.13.1

    - #### raiseDocumentPanelEvent

          public void raiseDocumentPanelEvent(DocumentPanelEvent event)

      Raise a `DocumentPanelEvent` on the DocumentPanel. In general this shouldn't be called unless you're extending one of the code classes, i.e. by writing your own `DocumentViewport`.
      Since:
        2.11.25

    - #### getSidePanels

          public Collection<SidePanel> getSidePanels()

      Return a read-only collection containing the `SidePanel` objects in use by this `DocumentPanel`.
      Since:
        2.10.3 (prior to this release a Map was returned instead)

    - #### removeSidePanel

          public void removeSidePanel(SidePanel panel)

      Remove the specified SidePanel from the DocumentPanel.
      Since:
        2.10.3

    - #### addSidePanel

          public void addSidePanel(SidePanel panel)

      Add the specified sidepanel to the DocumentPanel
      Since:
        2.10.3

    - #### setSelectedSidePanel

          public void setSelectedSidePanel(SidePanel panel)

      Set the currently displayed `SidePanel`. If the specified SidePanel is not in the list of SidePanels added to this DocumentPanel, this method does nothing.
      Parameters:
        `panel` - the SidePanel to display, or null to display no SidePanel
      Since:
        2.10.3 (prior to this release the name of the panel was specified instead)

    - #### getSelectedSidePanel

          public SidePanel getSelectedSidePanel()

      Return the currently selected `SidePanel`, or `null` if no panels are displayed.
      Since:
        2.10.3 (prior to this release the name of the panel was returned instead)

    - #### setPDF

          public void setPDF(PDF pdf)

      Set the PDF to be displayed by this `DocumentPanel`. A value of `null` will remove the current PDF from this object and free any resources that reference it - this should be done before this object is disposed of.
      Parameters:
        `pdf` - the PDF, or `null` to remove the current PDF

    - #### setPDF

          public void setPDF(PDF pdf,
                             PDFPage page)

      Set the PDF to be displayed by this `DocumentPanel`, and specify the initial page to display.
      Parameters:
        `pdf` - the PDF, or `null` to remove the current PDF
        `page` - the initial page to display, or `null` to not display an initial page (exactly how this is handled depends on the Viewport). This will be ignored if the DocumentPanel is part of a PDFViewer and the PDF has an open action that sets the page.
      Since:
        2.11

    - #### setPDF

          public void setPDF(PDFParser parser,
                             PDFPage page)

      Set the PDF to be displayed by this `DocumentPanel`, and specify the initial page to display and the exact `PDFParser` to use.
      Parameters:
        `parser` - the PDFParser to use to retrieve the PDF from
        `page` - the initial page to display, or `null` to not display an initial page (exactly how this is handled depends on the Viewport). This will be ignored if the DocumentPanel is part of a PDFViewer and the PDF has an open action that sets the page.
      Since:
        2.11.3

    - #### getParser

          public PDFParser getParser()

      Get the PDFParser being used to parse this PDF.

    - #### getPDF

          public PDF getPDF()

      Return the PDF currently being displayed by this `DocumentPanel`

    - #### getPage

          public PDFPage getPage()

      Return the PDFPage currently being displayed by the `DocumentViewport`. If no PDF is set or the first page is still being rendered, this method will return `null`.

    - #### getLinearizedSupport

          public LinearizedSupport getLinearizedSupport()

      Return the LinearizedSupport object for this DocumentPanel
      Since:
        2.14.1

    - #### setPageNumber

          public void setPageNumber(int i)

      Set the page being displayed. A shortcut for `setPage(getPDF().getPage(i))`.

    - #### getPageNumber

          public int getPageNumber()

      Return the pagenumber of the currently displayed page starting at 0, or -1 if no page is being displayed.

    - #### getZoom

          public float getZoom()

      Return the current zoom level. A value of 1 means the document is being displayed at it's actual size, 0.5 means 50% and so on.

    - #### setZoom

          public void setZoom(float zoom)

      Set the current zoom level
      Parameters:
        `zoom` - the zoom level

    - #### setPage

          public void setPage(PDFPage page)

      Set the page to display in the `DocumentViewport`. The page is displayed at it's top-left and at the current zoom level.
      Parameters:
        `page` - the page

    - #### setPage

          public void setPage(PDFPage page,
                              float x,
                              float y,
                              float zoom)

      Set the page to display in the `DocumentViewport`. The page is displayed at the co-ordinates supplied and at the specified zoom level.
      Parameters:
        `page` - the page
        `x` - the left-most position of the page to display, in units relative to `PagePanel.getFullPageView(org.faceless.pdf2.PDFPage)`
        `y` - the top-most position of the page to display, in units relative to `PagePanel.getFullPageView(org.faceless.pdf2.PDFPage)`
        `zoom` - the zoom level

    - #### redraw

          public void redraw(Object o)

      Deprecated. DocumentPanel.redraw() is no longer required as this object now listens to `PropertyChangeEvents` fired by the PDF. This method is not called anywhere and is a no-op
      Redraw the specified object. param o the Object that has been altered - typically a `PDFPage` or `PDFAnnotation`

    - #### setDirty

          public void setDirty(boolean dirty)

      Set the document as being "dirty", ie that it has been modified since loading. The property `noDirtyDocuments` can be set to prevent this value from being set.
      Since:
        2.11.19

    - #### getWindowTitle

          public String getWindowTitle()

      Get the base title of the window containing this DocumentPanel, which does not include any "*" or loading progress details.
      Since:
        2.15.4

    - #### setWindowTitle

          public void setWindowTitle(String title)

      Set the base title of the window containing this DocumentPanel
      Parameters:
        `title` - the new title.
      Since:
        2.15.4

    - #### isDirty

          public boolean isDirty()

      Return the value of the dirty flag, as set by `setDirty(boolean)`
      Since:
        2.11.19

    - #### addUndoableEditListener

          public void addUndoableEditListener(UndoableEditListener l)

      Add an `UndoableEditListener` to this DocumentPanel
      Since:
        2.11.19

    - #### removeUndoableEditListener

          public void removeUndoableEditListener(UndoableEditListener l)

      Remove an `UndoableEditListener` from this DocumentPanel
      Since:
        2.11.19

    - #### fireUndoableEditEvent

          public void fireUndoableEditEvent(UndoableEditEvent e)

      Fire an `UndoableEditEvent` on this DocumentPanel. As a special hack, passing `null` to this method will truncate the list of events
      Since:
        2.11.19

    - #### print

          public void print(PrintService fservice,
                            PrintRequestAttributeSet fatts)
                     throws PrintException,
                            PrinterException

      Display a Print dialog for printing this document, or if a `PrintService` is specified, print directly to that service without displaying a dialog.
      Parameters:
        `fservice` - the PrintService to print to. If this value is `null` a dialog will be displayed allowing the selection of a service.
        `fatts` - the print attributes - may be set to an AttributeSet to control the printing, or `null` to use the default.
      Throws:
        `PrintException`
        `PrinterException`

    - #### hasPermission

          public boolean hasPermission(String permission)

      Indicates whether the specified type of action is allowed for this DocumentPanel. A permission is allowed by default, but may be denied permanently by the Document's `EncryptionHandler`, or temporarily by a call to `setPermission(java.lang.String, boolean)`. The currently used list of permissions includes:
      Print
        The document may be printed.
      Extract
        Text may be extracted from the document.
      Assemble
        The pages in the document may be added, removed, rotated or reordered.
      Annotate
        Annotations may be added, removed, moved around, or edited.
      FormFill
        Form fields may be filled in and the form submitted.
      PageEdit
        The page content may be edited, ie the page may be cropped or redacted
      Save
        The document may be saved.
      Other non-standard permissions may be also be used if customization is required. By default anything not recognized will return true.
      Since:
        2.13
      See Also:
        `setPermission(java.lang.String, boolean)`, `setSignaturePermissionRestrictions(org.faceless.pdf2.FormSignature)`, `EncryptionHandler.hasRight(java.lang.String)`, `FormSignature.getCertificationType()`

    - #### setPermission

          public void setPermission(String permission,
                                    boolean enable)

      Sets whether the specified permission is allowed on this DocumentPanel.
      Parameters:
        `permission` - the permission
        `enable` - true to allow the action, false otherwise
      Since:
        2.13
      See Also:
        `hasPermission(java.lang.String)`, `setSignaturePermissionRestrictions(org.faceless.pdf2.FormSignature)`

    - #### setSignaturePermissionRestrictions

          public void setSignaturePermissionRestrictions(FormSignature sig)

      Limit the permissions that can be `set` on this PDF to ensure they don't conflict with the `certification` of this signature. This can be used to ensure that modifications to a PDF don't invalidate an existing digital siganture that disallows them. By default this is not the case, but setting the `respectSignatureCertification` initialization-parameter will ensure those restrictions are respected. This method can be called with `null` to make the setting of permissions unrestricted.
      Since:
        2.13
      See Also:
        `hasPermission(java.lang.String)`, `FormSignature.getCertificationType()`

    - #### setAssociatedFile

          public void setAssociatedFile(File file)

      Set the associated File on this DocumentPanel. The file is the filename which the PDF is assumed to have originated - typically it is set automatically, but if the PDF was loaded into the viewer manually this method may be called later to update the filename
      Parameters:
        `file` - the file
      Since:
        2.18.1

    - #### getAssociatedFile

          public File getAssociatedFile()

      Get the associated File from this DocumentPanel. This is typically set automatically if the PDF was loaded via an `Importer`, but may not be set if the `PDFViewer.loadPDF(java.io.File)` method was used instead. The `setAssociatedFile(java.io.File)` method can be called to set it in that case.
      Returns:
        file the file associated with this DocumentPanel, which may be null if it hasn't been set.
      Since:
        2.18.1

Copyright © 2001-2015 Big Faceless Organization