Class PDFViewer
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.faceless.pdf2.viewer2.PDFViewer
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable
public class PDFViewer extends JPanel implements Scrollable
The
PDFViewerclass is a simple Swing PDF viewer application. It demonstrates theDocumentPanelclass, and can be run directly from the JAR (via thePDFToolclass) like so.java -jar bfopdf.jar filename
The filename argument is optional, but if supplied will load the specified PDF.
The viewer is also a Swing component, and can be used like any other JComponent by adding it to a Swing hierarchy. All of the operations on the PDFViewer object (and any of the objects it references, like features, DocumentPanels and so on) require that the viewer has been added to the Swing a hierarchy. Attempting to use any of these features will fail
See the viewer tutorial for more detail on how to use this class and the "viewer" package.
The following initialization parameters may be specifiedcurrentUser The name of the current user - optional, but if set this will be set as the author field on any annotations created by the user unpromptedDirtyClose Whether to prompt the user for confirmation when closing a window containng a PDF that has been modifieddpi The resolution of the screen. This can be set to override Toolkit.getScreenResolution()if requiredfontScale The factor by which to multiply all fonts used in Swing (note: this will affect all components, not just those in the PDF viewer) Authenticator The class name of the default Authenticatorto use. If not specified, defaults to ourPromptingAuthenticatorwhich will prompt for HTTP passwords via a Swing dialog. It can be set to any classname, ornullto disable the authenticator.PromptingAuthenticator.Negotiate If set to "false", the PromptingAuthenticator will not prompt for the "Negiate" family of URL authentication. 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.5, with major rewrites in 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 Description PDFViewer(Collection<ViewerFeature> features)Creates new PDFViewer with the specified features
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddDocumentPanelListener(DocumentPanelListener listener)Add aDocumentPanelListenerto anyDocumentPanelobjects created by this PDFViewer.voidclose()Close the PDFViewer.voidcloseDocumentPanel(DocumentPanel panel)Close the specifiedDocumentPanelDocumentPanelgetActiveDocumentPanel()Return the activeDocumentPanelStringgetCurrentUser()Get the name of the current user, as set bysetCurrentUser(java.lang.String)DocumentPanelListener[]getDocumentPanelListeners()Return a list ofDocumentPanelListenerobjects added to this class with theaddDocumentPanelListener(org.faceless.pdf2.viewer2.DocumentPanelListener)methodDocumentPanel[]getDocumentPanels()Return all theDocumentPanels in the viewer<T extends ViewerFeature>
TgetFeature(Class<T> clazz)Return the firstViewerFeatureof the specified class, ornullif it doesn't exist for this viewer.ViewerFeaturegetFeature(String feature)ViewerFeature[]getFeatures()Return the list of all features set in the viewerJSManagergetJSManager()Return the JSManager object for this PDFViewer.KeyStoreManagergetKeyStoreManager()Get theKeyStoreManagerin use by this PDFViewerintgetMaxZoom()Returns the maximum zoom level that should be used.JMenugetMenu(String name)Return the specified Menu.intgetMinZoom()Returns the minimum zoom level that should be used.JComponentgetNamedComponent(String name)Return a Component created by aViewerFeaturePreferencesgetPreferences()Return thePreferencesobject that should be used to store user preferences about the viewer, ornullif preferences cannot be saved.DimensiongetPreferredScrollableViewportSize()ReturnsJComponent.getPreferredSize(); for theScrollableinterface.PropertyManagergetPropertyManager()Get thePropertyManagerin use by this PDFViewerintgetScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)Returns 0; for theScrollableinterface.booleangetScrollableTracksViewportHeight()Returns true; for theScrollableinterface.booleangetScrollableTracksViewportWidth()Returns true; for theScrollableinterface.intgetScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)Returns 0; for theScrollableinterface.booleangetUnpromptedDirtyClose()Return the value set bysetUnpromptedDirtyClose(boolean)int[]getZoomIntervals()Returns the zoom intervals that should be used to increase or decrease zoom level.booleanhasFeature(String feature)Return true if the Viewer has a certain feature enabled.booleanhasFeature(ViewerFeature feature)Return true if the Viewer has a certain feature enabled.booleanisClosing()Return true if theclose()method has been called on the PDFViewervoidloadPDF(File ffile)Load a PDF into the viewer from a file.voidloadPDF(File file, int pagenumber)Load a PDF into the viewer from a file.voidloadPDF(File file, EncryptionHandler handler)Deprecated.this method has been superceded by thePDFImporterclassvoidloadPDF(File file, EncryptionHandler[] handlers)Deprecated.this method has been superceded by thePDFImporterclassvoidloadPDF(InputStream in, EncryptionHandler[] handlers, String title, File file)Deprecated.this method has been superceded by thePDFImporterclassvoidloadPDF(URL url)Load a PDF into the viewer from a URL.voidloadPDF(PDFParser parser, String name)Load a pre-loaded PDF into the viewer.voidloadPDF(PDFParser parser, String name, int pagenumber)Load a pre-loaded PDF into the viewer.voidloadPDF(PDFParser parser, String name, int pagenumber, File file, boolean addtomostrecent, DocumentPanelListener listener)Load a pre-loaded PDF into the viewer.voidloadPDF(PDF pdf, String name)Load a pre-loaded PDF into the viewer.static voidmain(String[] args)The main() method can be invoked to run this class from the command line.static PDFViewernewPDFViewer()Create a new PDFViewer object in a frame of it's own.static PDFViewernewPDFViewer(Collection<ViewerFeature> features)Create a new PDFViewer object in a frame of its own with the specified features.voidputNamedComponent(String name, JComponent value)Add a named component to the viewers listvoidremoveDocumentPanelListener(DocumentPanelListener listener)Remove aDocumentPanelListenerpreviously added to the class with theaddDocumentPanelListener(org.faceless.pdf2.viewer2.DocumentPanelListener)method.voidremoveNotify()voidsetCurrentUser(String user)Set the name of the current user (for Annotations).voidsetKeyStoreManager(KeyStoreManager manager)Set theKeyStoreManagerused by this PDFViewerJMenuItemsetMenu(String name, char mnemonic, boolean documentrequired, ActionListener listener)Add or replace a menu item in the viewer.voidsetPreferences(Preferences preferences)Set thePreferencesobject returned fromgetPreferences().voidsetPropertyManager(PropertyManager manager)Set thePropertyManagerin use by this PDFViewervoidsetUnpromptedDirtyClose(boolean ignore)Set whether to allow a window containing a modified PDF to be closed without prompting.voidsetZoomIntervals(int[] intervals)Set the list of zoom intervals that should be used to increase or decrease zoom level.voidsetZoomRange(int min, int max)Set the minumum and maximum zoom values.-
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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
PDFViewer
public PDFViewer(Collection<ViewerFeature> features)
Creates new PDFViewer with the specified features- Parameters:
features- a Collection ofViewerFeatureobjects that are enabled- Since:
- 2.7.9
- See Also:
ViewerFeature
-
-
Method Detail
-
getPreferences
public Preferences getPreferences()
Return thePreferencesobject that should be used to store user preferences about the viewer, ornullif preferences cannot be saved.- Since:
- 2.11
-
setPreferences
public void setPreferences(Preferences preferences)
Set thePreferencesobject returned fromgetPreferences(). There's normally no reason to do this unless particularly don't want to use the normal system preferences in the viewer- Since:
- 2.18.2
-
getJSManager
public JSManager getJSManager()
Return the JSManager object for this PDFViewer.- Since:
- 2.9
-
setPropertyManager
public final void setPropertyManager(PropertyManager manager)
Set thePropertyManagerin use by this PDFViewer- Since:
- 2.8.5
-
getPropertyManager
public final PropertyManager getPropertyManager()
Get thePropertyManagerin use by this PDFViewer- Since:
- 2.8.5
-
getKeyStoreManager
public KeyStoreManager getKeyStoreManager()
Get theKeyStoreManagerin use by this PDFViewer- Since:
- 2.8.3
-
setKeyStoreManager
public void setKeyStoreManager(KeyStoreManager manager)
Set theKeyStoreManagerused by this PDFViewer- Since:
- 2.8.3
-
hasFeature
public boolean hasFeature(ViewerFeature feature)
Return true if the Viewer has a certain feature enabled.- Parameters:
feature- the feature to look for
-
hasFeature
public boolean hasFeature(String feature)
Return true if the Viewer has a certain feature enabled.- Parameters:
feature- the name of the feature to look for
-
getFeatures
public ViewerFeature[] getFeatures()
Return the list of all features set in the viewer
-
getFeature
public ViewerFeature getFeature(String feature)
- Parameters:
feature- the name of the feature- Since:
- 2.8.5
-
getFeature
public <T extends ViewerFeature> T getFeature(Class<T> clazz)
Return the firstViewerFeatureof the specified class, ornullif it doesn't exist for this viewer. For examplePDFImporter importer = viewer.getFeature(PDFImporter.class);
- Parameters:
clazz- the Class of the ViewerFeature.- Since:
- 2.10.2
-
setMenu
public JMenuItem setMenu(String name, char mnemonic, boolean documentrequired, ActionListener listener)
Add or replace a menu item in the viewer. Since 2.13.1, if the supplied listener is anActionthen theAction.NAMEandAction.ACCELERATOR_KEY(if set) will override thenameandmnemonicsupplied here, and thedocumentrequiredparameter will be ignored, as the Action is expected to manage it's ownenabledstate.- Parameters:
name- the name of the menu, if the form "File\tOpen" or "File\tQuit(999)". The tab character is used to separate the items in the menu hierarchy, and the optional bracketed value is used to control ordering in the menu.mnemonic- the mnemonic to assign to this menu - lowercase or uppercase letter, or(char)0for no mnenonicdocumentrequired- whether this menu item should only be enabled if a document is loadedlistener- theActionListenerto run when this menu item is activated- Since:
- 2.10.2
-
getMenu
public JMenu getMenu(String name)
Return the specified Menu. If the menu doesn't exist, it's created- Parameters:
name- the name of the Menu, before it's been localized- Since:
- 2.10.4
-
putNamedComponent
public void putNamedComponent(String name, JComponent value)
Add a named component to the viewers list- Since:
- 2.10.2
-
getNamedComponent
public JComponent getNamedComponent(String name)
Return a Component created by aViewerFeature
-
getPreferredScrollableViewportSize
public Dimension getPreferredScrollableViewportSize()
ReturnsJComponent.getPreferredSize(); for theScrollableinterface.- Specified by:
getPreferredScrollableViewportSizein interfaceScrollable
-
getScrollableUnitIncrement
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
Returns 0; for theScrollableinterface.- Specified by:
getScrollableUnitIncrementin interfaceScrollable
-
getScrollableBlockIncrement
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
Returns 0; for theScrollableinterface.- Specified by:
getScrollableBlockIncrementin interfaceScrollable
-
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()
Returns true; for theScrollableinterface.- Specified by:
getScrollableTracksViewportWidthin interfaceScrollable
-
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()
Returns true; for theScrollableinterface.- Specified by:
getScrollableTracksViewportHeightin interfaceScrollable
-
loadPDF
public void loadPDF(File ffile)
Load a PDF into the viewer from a file. This method will search theImporterobjects in order until it finds one that matches the file, then will use that to load the PDF into the viewer. Prompting for passwords etc. is left to the appropriateImporter- see thePDFImporterclass for details on the default behaviour.- Parameters:
ffile- the PDF file to load, ornullto select it with a chooser- Since:
- 2.7.1
-
loadPDF
public void loadPDF(File file, int pagenumber)
Load a PDF into the viewer from a file. This method will search theImporterobjects in order until it finds one that matches the file, then will use that to load the PDF into the viewer. Prompting for passwords etc. is left to the appropriateImporter- see thePDFImporterclass for details on the default behaviour.- Parameters:
file- the PDF file to load, ornullto select it with a chooserpagenumber- the initial page number to request. May be overridden- Since:
- 2.11.10
-
loadPDF
@Deprecated public void loadPDF(File file, EncryptionHandler handler)
Deprecated.this method has been superceded by thePDFImporterclassLoad a PDF into the viewer from a file using the specified EncryptionHandler. This method is now deprecated - the correct way to load a PDF with custom EncryptionHandlers is to modify thePDFImporterpassed in to the PDF Constructor.- Parameters:
file- the PDF Filehandler- the EncryptionHandler to use- Since:
- 2.8
-
loadPDF
@Deprecated public void loadPDF(File file, EncryptionHandler[] handlers)
Deprecated.this method has been superceded by thePDFImporterclassLoad a PDF into the viewer from a file using the specified list of EncryptionHandler. This method is now deprecated - the correct way to load a PDF with custom EncryptionHandlers is to modify thePDFImporterpassed in to the PDF Constructor.- Parameters:
file- the PDF Filehandlers- the list of EncryptionHandlers- Since:
- 2.8
-
loadPDF
@Deprecated public void loadPDF(InputStream in, EncryptionHandler[] handlers, String title, File file)
Deprecated.this method has been superceded by thePDFImporterclassLoad a PDF into the viewer from an InputStream. Note that this method will return immediately, which means the calling thread must not close the InputStream. Doing so will result in an Exception. The stream will be closed by the reading thread when it is completed.
This method is now deprecated - the correct way to load a PDF from an InputStream is to call the
Importer.getImporter(PDFViewer, InputStream, String, File)method. For example:PDFImporter importer = viewer.getFeature(PDFImporter.class); importer.getImporter(viewer, inputstream, title, file).start(viewer, "Loading");
- Parameters:
in- the InputStream to load the PDF fromhandlers- the EncryptionHandlers to use to try to decrypt the PDFtitle- The name of the Window. May be null.file- If using a save dialog, the initial value to set the dialog to. May be null.- Since:
- 2.8.3
-
loadPDF
public void loadPDF(URL url) throws IOException
Load a PDF into the viewer from a URL. If the URL contains a fragment which is a valid page number, that page will be selected on load.- Parameters:
url- the URL to load- Throws:
IOException- Since:
- 2.14
- See Also:
PDFImporter
-
loadPDF
public void loadPDF(PDF pdf, String name)
Load a pre-loaded PDF into the viewer. Simply callsloadPDF(new PDFParser(pdf), name).- Parameters:
pdf- the PDF to loadname- the name of the PDF, to display in the title bar.- Since:
- 2.7.1
-
loadPDF
public void loadPDF(PDFParser parser, String name)
Load a pre-loaded PDF into the viewer.- Parameters:
parser- the PDFParser referencing the PDF to loadname- the name of the PDF, to display in the title bar.- Since:
- 2.11.3
-
loadPDF
public void loadPDF(PDFParser parser, String name, int pagenumber)
Load a pre-loaded PDF into the viewer.- Parameters:
parser- the PDFParser referencing the PDF to loadname- the name of the PDF, to display in the title bar.pagenumber- the initial page to display- Since:
- 2.11.3
-
loadPDF
public void loadPDF(PDFParser parser, String name, int pagenumber, File file, boolean addtomostrecent, DocumentPanelListener listener)
Load a pre-loaded PDF into the viewer.- Parameters:
parser- the PDFParser referencing the PDF to loadname- the name of the PDF, to display in the title barpagenumber- the initial page to displayfile- the file to pass toDocumentPanel.setAssociatedFile(java.io.File, boolean). May be null.addtomostrecent- whether to add the File containing the PDF to the list of recently opened fileslistener- an optional callback object. If specified, this listener will be called with a "created"DocumentPanelEventspecifying the DocumentPanel created by this method. The listener will not be added to the PDFViewer'slist, and the event will not be fired in the normal way to those listener. This approach can be used to run a one-off action on the panel immediately when it's created, without needing to add listeners and wait for the event to be fired.- Since:
- 2.18.1
-
getActiveDocumentPanel
public DocumentPanel getActiveDocumentPanel()
Return the activeDocumentPanel
-
getDocumentPanels
public DocumentPanel[] getDocumentPanels()
Return all theDocumentPanels in the viewer- Since:
- 2.8.5
-
removeNotify
public void removeNotify()
- Overrides:
removeNotifyin classJComponent
-
isClosing
public boolean isClosing()
Return true if theclose()method has been called on the PDFViewer
-
close
public void close()
Close the PDFViewer. Should be called before this PDFViewer is permanently removed from the Swing object hierarchy.- Since:
- 2.11.18
-
closeDocumentPanel
public void closeDocumentPanel(DocumentPanel panel)
Close the specifiedDocumentPanel- Parameters:
panel- the panel to close - usually the return value ofgetActiveDocumentPanel()- Since:
- 2.10.2
-
addDocumentPanelListener
public void addDocumentPanelListener(DocumentPanelListener listener)
Add aDocumentPanelListenerto anyDocumentPanelobjects created by this PDFViewer. The listener will be attached to any existingDocumentPanelobjects, and added to any new ones that are created later.
-
removeDocumentPanelListener
public void removeDocumentPanelListener(DocumentPanelListener listener)
Remove aDocumentPanelListenerpreviously added to the class with theaddDocumentPanelListener(org.faceless.pdf2.viewer2.DocumentPanelListener)method.
-
getDocumentPanelListeners
public DocumentPanelListener[] getDocumentPanelListeners()
Return a list ofDocumentPanelListenerobjects added to this class with theaddDocumentPanelListener(org.faceless.pdf2.viewer2.DocumentPanelListener)method- Since:
- 2.13.1
-
newPDFViewer
public static PDFViewer newPDFViewer()
Create a new PDFViewer object in a frame of it's own. Top level routine to be called by main()- Since:
- 2.7..1
-
newPDFViewer
public static PDFViewer newPDFViewer(Collection<ViewerFeature> features)
Create a new PDFViewer object in a frame of its own with the specified features.- Parameters:
features- a Collection ofViewerFeatureobjects that are to be supported- Since:
- 2.7.9
- See Also:
ViewerFeature
-
main
public static void main(String[] args)
The main() method can be invoked to run this class from the command line. A single argument specifying the name of the file to open is optional
-
setCurrentUser
public void setCurrentUser(String user)
Set the name of the current user (for Annotations). The default is null. Can also be set by thecurrentUserinitialization parameter- Since:
- 2.11.18
-
getCurrentUser
public String getCurrentUser()
Get the name of the current user, as set bysetCurrentUser(java.lang.String)- Since:
- 2.11.18
-
setUnpromptedDirtyClose
public void setUnpromptedDirtyClose(boolean ignore)
Set whether to allow a window containing a modified PDF to be closed without prompting. Can also be set by theunpromptedDirtyCloseinitialization parameter- Since:
- 2.11.19
-
getUnpromptedDirtyClose
public boolean getUnpromptedDirtyClose()
Return the value set bysetUnpromptedDirtyClose(boolean)- Since:
- 2.11.19
-
getMinZoom
public int getMinZoom()
Returns the minimum zoom level that should be used.- Since:
- 2.18
-
getMaxZoom
public int getMaxZoom()
Returns the maximum zoom level that should be used.- Since:
- 2.18
-
setZoomRange
public void setZoomRange(int min, int max)Set the minumum and maximum zoom values. Requires 1 <= min <= max <= 9999.- Parameters:
min- the minimum zoom level - the default is 1max- the minimum zoom level - the default is 9999- Since:
- 2.18
-
getZoomIntervals
public int[] getZoomIntervals()
Returns the zoom intervals that should be used to increase or decrease zoom level.- Since:
- 2.18
-
setZoomIntervals
public void setZoomIntervals(int[] intervals)
Set the list of zoom intervals that should be used to increase or decrease zoom level. The list must be >= 1 item long, in ascending order, and all values must fall between min and max as set bysetZoomRange(int, int)- Parameters:
intervals- the list of zoom intervals- Since:
- 2.18
-
-