com.qoppa.pdfNotes
Class PDFNotesBean

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.qoppa.pdfViewer.PDFViewerBean
                      extended by com.qoppa.pdfNotes.PDFNotesBean
All Implemented Interfaces:
IDocumentListener, IPassword, IPDFSaver, IPDFActionHandler, IPDFOpener, ActionListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
PDFEditorBean

public class PDFNotesBean
extends PDFViewerBean
implements IPDFSaver

PDFNotesBean is a component that can be used to display and annotate PDF documents within an application or an applet. The bean takes a PDF document as a file name, a URL or an InputStream, reads the document and then displays the document, allowing the user to navigate and add annotations to the document.

The bean can save the document to a file but also allows the host application to define a custom 'saver' to be able to save the document somewhere different than a file (database, server, etc). The bean can be extended and the save method overridden to get the same effect.

Author:
Qoppa Software
See Also:
Serialized Form

Nested Class Summary
static class PDFNotesBean.KeyInfoNotes
           This is the Main-Class for the jPDFNotes.jar that can generate server key requests, validate a key, and display server information.
 
Nested classes/interfaces inherited from class com.qoppa.pdfViewer.PDFViewerBean
PDFViewerBean.KeyInfoViewer
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
static String UNTITLED
          Deprecated.  
 
Fields inherited from class com.qoppa.pdfViewer.PDFViewerBean
PAGEMODE_CONTINUOUS, PAGEMODE_COVER, PAGEMODE_COVER_CONTINUOUS, PAGEMODE_FACING, PAGEMODE_FACING_CONTINUOUS, PAGEMODE_SINGLEPAGE, SPLITPOLICY_NEVER_VISIBLE, SPLITPOLICY_USEDOCUMENTPAGEMODE, ZOOMMODE_FITPAGE, ZOOMMODE_FITWIDTH, ZOOMMODE_NORMAL
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
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
PDFNotesBean()
          Construct a PDFNotesBean.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          This method handles actions from the toolbars in the bean.
 JButton activateOCR()
          Activates the OCR function for this PDFNotesBean.
 void addAnnotation(Annotation newAnnot, int pageIndex)
          Add an annotation to the document programmatically.
 void addAnnotation(Annotation newAnnot, int pageIndex, boolean setRotation)
          Add an annotation to the document programmatically.
 void addPDFListener(IPDFListener listener)
          Adds a PDF Listener object to receive notifications when a new document is opened.
 void addSignatureField()
          This method starts the signature field creation process.
 SignatureField addSignatureField(String fieldName, Rectangle2D bounds, int pageIndex)
          Add a signature field to a page in the currently loaded document.
 boolean canPaste()
          Look at the contents of the system clipboard and determine if the object in the clipboard can be pasted into jPDFNotes.
 boolean close(boolean checkSave)
          This method closes the current document.
 void documentChanged(DocumentEvent de)
          Internal method, do not use.
 void enableThumbPaneEditing(boolean enable)
          Deprecated. This method moved to the ThumbNailPanelNotes interface. Use PDFNotesBean.getThumbnailPanelNotes().enableEditing(enable) instead.
 void exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile)
          Deprecated. Use getMutableDocument().exportAnnotsAsFDF() instead
 void exportAnnotsAsFDF(String fileName)
          Deprecated. Use getMutableDocument().exportAnnotsAFDF() instead
 void exportAnnotsAsXFDF(OutputStream outStream, String pathToPDFFile)
          Deprecated. Use getMutableDocument().exportAnnotsAsXFDF() instead
 void exportAnnotsAsXFDF(String fileName)
          Deprecated. Use getMutableDocument().exportAnnotsAsXFDF() instead
 AnnotAlignmentToolbar getAnnotAlignmentToolBar()
          Returns the AnnotAlignmentToolbar used to align selected annotations
 IAnnotationManager getAnnotationManager()
          Returns the annotation manager for this PDFViewerBean.
 AnnotPropertiesToolbar getAnnotPropertiesToolBar()
          Returns the AnnotPropertiesToolbar used to modify common annotation properties.
 AnnotToolbar getAnnotToolbar()
          Returns the annotation tools toolbar.
 CommentPanelNotes getCommentPanelNotes()
          Returns an interface to allow access to the comment panel.
 String getCurrentDocName()
          Deprecated. Use getDocument().getPDFSource().getName()
 String getCurrentDocPath()
          Deprecated. Use getDocument().getPDFSource().getPath()
 EditToolbar getEditToolbar()
          Returns the standard toolbar.
 MutableDocument getMutableDocument()
          This method returns a mutable PDF document, that is, a document that can be modified by the calling applications.
 PageViewContextMenuNotes getNotesContextMenu()
          Deprecated. Use getPageViewPanel.getPageContextMenu()
 int getPageRotation(int pageIndex)
          Deprecated. This method has moved to the MutableDocument interface.
 PageViewPanelNotes getPageViewPanelNotes()
          Returns an interface to allow access to the page view panel.
 SelectToolbar getSelectToolbar()
          Returns the selection toolbar.
 SelectToolbarNotes getSelectToolbarNotes()
          The PDFNotesBean select toolbar.
 SignaturePanelNotes getSignaturePanelNotes()
          Returns an interface to allow access to the signature panel.
 ThumbnailPanelNotes getThumbnailPanelNotes()
          Returns a reference to the thumbnail panel, the panel that displays the page thumbnails.
 UndoManager getUndoManager()
          Returns the UndoManager for this PDFNotesBean.
static String getVersion()
          Returns version string for jPDFNotes.
 WidgetHandler getWidgetHandler()
           Returns the WidgetHandler to be used to set the value to a FormField when its corresponding WidgetComponent is modified.
 void handleAction(Action action)
          This method overrides the PDFViewerBean handleAction to take care of actions that are specific to jPDFNotes, such as saving the document.
 void importAnnotsFromFDF(InputStream inStream)
          Deprecated. Use getMutableDocument().importAnnotsFromFDF() instead
 void importAnnotsFromFDF(String fileName)
          Deprecated. Use getMutableDocument().importAnnotsFromFDF() instead
 void importAnnotsFromXFDF(InputStream inStream)
          Deprecated. Use getMutableDocument().importAnnotsFromXFDF() instead
 void importAnnotsFromXFDF(String fileName)
          Deprecated. Use getMutableDocument().importAnnotsFromXFDF() instead
 boolean isCreateTempOnSave()
          Returns whether or not a temporary file will be created during a save operation.
 boolean isModified()
          Returns whether this document has been modified or not.
 boolean isOpenPDFOnly()
          Returns whether the user is allowed to open PDF files only.
 void keyPressed(KeyEvent e)
          Handle key pressed events.
 void loadDocument(InputStream inStream, String formatName)
          Open a document from an input stream.
 void loadDocument(String fileName)
          Method to open files of PDF, JPEG, TIFF and PNG types.
 void loadFDF(String fileName)
          Load an FDF file.
 void loadFile(String fileName)
          Deprecated. Use loadDocument (String fileName) instead
 void loadPDF(InputStream inStream)
          Load and display a PDF document using an InputStream.
 void loadPDF(PDFSource pdfSource)
          Load and display a PDF document using a PDFSource object
 void loadPDF(String fileName)
          Load and display a PDF document using a file name.
 void loadPDF(URL url)
          Load and display a PDF document using a URL.
 void loadTextDocument(String fileName, TextToPDFSettings settings)
          Method to open text files .
 void loadXFDF(String fileName)
          Load an XFDF file.
 void openFile(PDFViewerBean viewerBean)
          This method is called whenever the user presses the file open button.
 void paste()
          this method checks the clipboard and pastes any object that it can handle into the document.
 void print(PrintSettings printSettings)
          Prints the PDF document to a printer.
 void reloadDocument()
          Reloads a document into the viewer.
 void removeAnnotation(Annotation annot, int pageIndex)
          Remove an annotation from the document programmatically.
 boolean removePDFListener(IPDFListener listener)
          Removes a PDF Listener object.
 void revert()
          Reverts the loaded document to the original document.
 boolean save()
          This method saves the current document, it is called when the Save button is pressed in the toolbar.
 boolean save(PDFNotesBean notesBean, String docName, File pdfFile)
          This method saves the pdf to a file.
 boolean saveAs()
          This method implements the standard 'Save As...' function by prompting for a new file name and calling the save method with this file name.
 void saveDocument(OutputStream outStream)
          Saves a copy of this document to an output stream.
 void saveDocument(String fileName)
          Saves a copy of this document to a file.
static boolean setAppletKey(String key, Applet applet)
          Sets the product key when running from an applet.
 void setCommentComponentsVisible(boolean visible)
          This method will set hiding of comments components on and off.
 void setCreateTempOnSave(boolean createTempOnSave)
          Sets whether or not a temporary file is to be created during a save operation when saving over an existing file.
 void setDocument(IPDFDocument pdfDoc)
          Sets this bean's document.
static boolean setKey(String key)
          Sets product key.
 void setModified(boolean modified)
          Flag this document as modified.
 void setOpenPDFOnly(boolean openPDFOnly)
          Sets a flag to determine whether the user can open PDF files only, or is allowed to open image files in JPEG, TIFF or PNG formats.
 void setPageRotation(int pageIndex, int degrees)
          Deprecated. This method has moved to the MutableDocument interface.
 void setPDFSaver(IPDFSaver saver)
          This method allows the host application to override the default PDF Saver, the class that saves the document when the save toolbar button is pressed.
 void signDocument(SignatureField signField)
          Starts the signing GUI for a given signature field.
 void signDocument(SignatureField signField, SigningInformation signingInfo, File outputFile)
          This method will sign and save the document.
 void startEdit(Annotation annot, boolean useDefault)
          Deprecated.  
 void startEdit(Annotation annot, boolean useDefault, boolean isSticky)
          This method starts an annotation editor appropriate to the type of annotation passed to it.
 void startMeasurementCalibration()
          This method begins the process of calibrating the scale used with the Distance, Perimeter, and Area measuring tools.
 void stopWidgetEditing()
          Stops any field editing currently in progress.
 
Methods inherited from class com.qoppa.pdfViewer.PDFViewerBean
addAnnotationToSelection, addHistoryListener, clearDocument, closeTextSearch, deselectAnnotation, getAcroForm, getAttachmentPanel, getBookmarkPanel, getCommentPanel, getCurrentLocation, getDocument, getInitialViewSettings, getLayerPanel, getLocationHistory, getPageByLocation, getPageCount, getPageMode, getPageNumber, getPageView, getPageViewPanel, getPasswordHandler, getPasswords, getRootPane, getRotation, getScale, getScale2D, getScrollPane, getSelectedText, getSelectTextContextMenu, getSignaturePanel, getSplitPolicy, getSubmitActionEmailHandler, getThumbnailPanel, getToolbar, getToolbarButtonGroup, getViewerContextMenu, getWatermark, getZoomMode, gotoNextView, gotoPreviousView, isAttachmentsTabSelected, isBookmarksTabSelected, isCommentComponentsVisible, isCommentsTabSelected, isCommentsVisible, isFieldsHighlight, isIncrementalLoading, isLayersTabSelected, isPagesTabSelected, isSignaturesTabSelected, isSplitOpen, keyReleased, keyTyped, openFile, removeHistoryListener, rotateCCW, rotateCW, scrollToAnnotation, scrollToPage, scrollToPage, selectAnnotation, setCommentsVisible, setFieldsHighlight, setHorzDividerLocation, setIncrementalLoad, setInvertColorsMode, setLocationHistory, setPage, setPageMode, setPasswordHandler, setPDFOpener, setPrintSettings, setRotation, setScale, setScale2D, setSnapshotHandler, setSplitOpen, setSplitPolicy, setSplitVisible, setSplitVisible, setSubmitActionEmailHandler, setTabCommentsVisible, setTextSelectionColors, setVertDividerLocation, setWatermark, setZoomMode, showError, showMessage, showTabAttachments, showTabBookmarks, showTabLayers, showTabSignature, showTabThumbnails, startLoupeTool, startMagnifyRect, startTextSearch, startTextSearch, startTextSelection, stopTextSelection, zoomToRect
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, hide, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNTITLED

public static String UNTITLED
Deprecated. 
The default name for new documents or documents opened from an InputStream. This string is internationalized.

Constructor Detail

PDFNotesBean

public PDFNotesBean()
Construct a PDFNotesBean.

Method Detail

getVersion

public static String getVersion()
Returns version string for jPDFNotes. If this is the demo version, the return string will contain 'Demo Version' at the end.


setKey

public static boolean setKey(String key)
Sets product key. Use this method after purchasing to remove evaluation restrictions.

Parameters:
key - Product key.

setAppletKey

public static boolean setAppletKey(String key,
                                   Applet applet)
Sets the product key when running from an applet. Use this method after purchasing to remove evaluation restrictions.

Parameters:
key - Product key
applet - The applet that we are running in.

getEditToolbar

public EditToolbar getEditToolbar()
Returns the standard toolbar. Host applications can use this method to be able to change the behaviour of the toolbar, such as making buttons visible/invisible, adding listeners, etc. Please see EditToolbar for details.

Returns:
The edit bean's toolbar.

reloadDocument

public void reloadDocument()
Reloads a document into the viewer. This method should be called when a document has been modified in some way that the viewer would not detect. When the method is called, bookmarks, page thumb views, etc are re-generated.


removeAnnotation

public void removeAnnotation(Annotation annot,
                             int pageIndex)
                      throws PDFException
Remove an annotation from the document programmatically. Using this method, the host application can remove annotations from the document without user interaction.

Parameters:
annot - The annotation to be removed
pageIndex - The page where the annotation is currently displayed, pageIndex starts at 0.
Throws:
PDFException

getAnnotToolbar

public AnnotToolbar getAnnotToolbar()
Returns the annotation tools toolbar. This method provides access to the annotation toolbar so that the host application can modify the standard behaviour and buttons of the toolbar.

Returns:
Reference to the annotation toolbar.

getThumbnailPanelNotes

public ThumbnailPanelNotes getThumbnailPanelNotes()
Returns a reference to the thumbnail panel, the panel that displays the page thumbnails.

Returns:
Reference to the thumbnail panel.

enableThumbPaneEditing

public void enableThumbPaneEditing(boolean enable)
Deprecated. This method moved to the ThumbNailPanelNotes interface. Use PDFNotesBean.getThumbnailPanelNotes().enableEditing(enable) instead.

Turn thumb pane editing on or off. Thumb pane editing is implemented using a context menu on the page thumbnails pane. Options in the context menu include moving pages, deleting pages and others.

Parameters:
enable - Flag indicating whether to enable the editing.

actionPerformed

public void actionPerformed(ActionEvent ae)
This method handles actions from the toolbars in the bean. The method overrides PDFViewerBean to handle editing commands and calls PDFViewerBean.actionPerformed for the standard buttons.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class PDFViewerBean
Parameters:
ae - The action event.

getSelectToolbar

public SelectToolbar getSelectToolbar()
Returns the selection toolbar. This toolbar has three icons, the hand icon to allow users to drag the document around with the mouse, the text select icon to let the user select text in the document, and the snapshot icon to allow users to capture an image. As with the navigation toolbar, the host application can choose not to show this toolbar by calling getSelectToolbar().setVisible (false).

Overrides:
getSelectToolbar in class PDFViewerBean
Returns:
Reference to the selection toolbar.

getSelectToolbarNotes

public SelectToolbarNotes getSelectToolbarNotes()
The PDFNotesBean select toolbar. This Select toolbar extends SelectToolbar and adds a Select Object button.

Returns:
Reference to the PDFNotesBean selection toolbar.

getMutableDocument

public MutableDocument getMutableDocument()
This method returns a mutable PDF document, that is, a document that can be modified by the calling applications. Any changes to the document made through this object will be reflected on the screen: i.e. if a page is deleted, it will be removed from the view

Returns:
An object that allows modifications to the underlying PDF document.

startEdit

public void startEdit(Annotation annot,
                      boolean useDefault)
Deprecated. 

This method has been replaced with a new version that takes an additional argument, and so it has been deprecated.

Parameters:
annot - The annotation to create
useDefault - Annotation defaults

startEdit

public void startEdit(Annotation annot,
                      boolean useDefault,
                      boolean isSticky)
This method starts an annotation editor appropriate to the type of annotation passed to it. The method will start different editors for the following annotation types: Circle, Square, Ink, FreeText, Text, Sound and Link.

Parameters:
annot - An annotation object.
useDefault - Flag indicating whether the annotation properties should be set to default properties, as determined by the classes in the com.qoppa.pdfNotes.settings package
isSticky - Flag indicating whether this tool should be "sticky". When a tool is sticky, it will start over after the user is done adding the annotation

revert

public void revert()
Reverts the loaded document to the original document. If the document has been modified, this method will prompt the user to discard any changes, and then load the document. If a document was loaded from a file, the document will be reloaded from the file.


close

public boolean close(boolean checkSave)
This method closes the current document. The method first checks if the current document has been modified (optionally) and if it has, asks the user whether it should be saved.

Parameters:
checkSave - Tells the method whether to ask the user to save the current document if it has been modified.
Returns:
true if the document was closed, false if user pressed cancel

setDocument

public void setDocument(IPDFDocument pdfDoc)
Sets this bean's document. When this method is called, the bean will go back to page 1 of the document and reset the page control in the toolbar. The method will also start generating a new set of thumbviews for the pages.

Overrides:
setDocument in class PDFViewerBean
Parameters:
pdfDoc - The new document.

setCommentComponentsVisible

public void setCommentComponentsVisible(boolean visible)
Description copied from class: PDFViewerBean
This method will set hiding of comments components on and off. When false, comment components will be dynamically hidden. Comments will still show in the comment pane, but will not be displayed in the viewer. They will also not be rendered when printing. When true, comment components will be displayed as normal.

Overrides:
setCommentComponentsVisible in class PDFViewerBean
Parameters:
visible - Comment visibility flag

save

public boolean save(PDFNotesBean notesBean,
                    String docName,
                    File pdfFile)
This method saves the pdf to a file. If there is no file name available, the method will prompt the user for a file name and then save to that file. If the pdfFile argument is null, this method behaves the same as saveAs(), it will prompt the user for a file name.

This method fulfills the IPDFSaver interface and will be called by the Save button on the toolbar unless the saver has been set by the host application.

This method can be overridden by a class that extends PDFNotesBean to customize saving behavior. Alternatively, a host application can call setPDFSaver with an object that implements IPDFSaver to use a custom saver. After setPDFSaver is called, all save functions will use the saver supplied by the host application.

Specified by:
save in interface IPDFSaver
Parameters:
notesBean - Reference to the PDFNotesBean that holds the document.
docName - The name of the PDF document, normally the file name.
pdfFile - A reference to a file object if the PDF was loaded from a file, null if the PDF was opened from a URL or an InputStream.
Returns:
true if the document was saved properly, false if there was any errors.
See Also:
save(), saveAs()

saveDocument

public void saveDocument(String fileName)
                  throws PDFException,
                         IOException
Saves a copy of this document to a file.

Parameters:
fileName - Name of the file to save the document.
Throws:
PDFException
IOException

exportAnnotsAsFDF

public void exportAnnotsAsFDF(OutputStream outStream,
                              String pathToPDFFile)
                       throws PDFException,
                              IOException
Deprecated. Use getMutableDocument().exportAnnotsAsFDF() instead

Export annotations comments to an output stream in FDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the fdf file to the pdf file name. This parameter can be left null. This parameter is used to fill the pdf file name entry in the FDF file, the file entry will be set to pathToPDFFile + fileName The file entry is used when you open an fdf file to be able to locate the corresponding pdf file. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException
IOException

exportAnnotsAsXFDF

public void exportAnnotsAsXFDF(OutputStream outStream,
                               String pathToPDFFile)
                        throws PDFException,
                               IOException
Deprecated. Use getMutableDocument().exportAnnotsAsXFDF() instead

Export annotations comments to an output stream in XFDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the xfdf file to the pdf file name. This parameter can be left null. This parameter is used to fill the pdf file name entry in the XFDF file, the file entry will be set to pathToPDFFile + fileName The file entry is used when you open an xfdf file to be able to locate the corresponding pdf file. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException
IOException

exportAnnotsAsFDF

public void exportAnnotsAsFDF(String fileName)
                       throws PDFException
Deprecated. Use getMutableDocument().exportAnnotsAFDF() instead

Exports annotations comments in FDF format to a file.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

exportAnnotsAsXFDF

public void exportAnnotsAsXFDF(String fileName)
                        throws PDFException
Deprecated. Use getMutableDocument().exportAnnotsAsXFDF() instead

Exports annotations comments in XFDF format to a file.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

importAnnotsFromFDF

public void importAnnotsFromFDF(InputStream inStream)
                         throws PDFException
Deprecated. Use getMutableDocument().importAnnotsFromFDF() instead

Import annotations comments from an input stream in FDF format.

Parameters:
inStream - The input stream in FDF format to read the data from.
Throws:
PDFException

importAnnotsFromFDF

public void importAnnotsFromFDF(String fileName)
                         throws PDFException
Deprecated. Use getMutableDocument().importAnnotsFromFDF() instead

Import annotations comments from a file in XFDF Format.

Parameters:
fileName - The name of the XFDF file to import the data from.
Throws:
PDFException

importAnnotsFromXFDF

public void importAnnotsFromXFDF(InputStream inStream)
                          throws PDFException
Deprecated. Use getMutableDocument().importAnnotsFromXFDF() instead

Import annotations comments from an input stream in XFDF format.

Parameters:
inStream - The input stream in XFDF format to read the data from.
Throws:
PDFException

importAnnotsFromXFDF

public void importAnnotsFromXFDF(String fileName)
                          throws PDFException
Deprecated. Use getMutableDocument().importAnnotsFromXFDF() instead

Import annotations comments from a file in FDF Format.

Parameters:
fileName - The name of the FDF file to import the data from.
Throws:
PDFException

saveDocument

public void saveDocument(OutputStream outStream)
                  throws IOException,
                         PDFException
Saves a copy of this document to an output stream. This method can be used in conjunction with a ByteArrayOutputStream to get a byte array holding the PDF document.

Parameters:
outStream - OutputStream where the document will be written to.
Throws:
IOException
PDFException

saveAs

public boolean saveAs()
This method implements the standard 'Save As...' function by prompting for a new file name and calling the save method with this file name.

Returns:
true if the document was saved properly, false if there were any errors or if user canceled.
See Also:
save(), save(PDFNotesBean, String, File)

save

public boolean save()
This method saves the current document, it is called when the Save button is pressed in the toolbar.

Returns:
true if the document was saved properly, false if there were any errors.

loadPDF

public void loadPDF(PDFSource pdfSource)
             throws PDFException
Load and display a PDF document using a PDFSource object

Overrides:
loadPDF in class PDFViewerBean
Parameters:
pdfSource - Object that implements the PDFSource interface.
Throws:
PDFException

loadPDF

public void loadPDF(InputStream inStream)
             throws PDFException
Load and display a PDF document using an InputStream.

Overrides:
loadPDF in class PDFViewerBean
Parameters:
inStream - InputStream used to read the PDF document.
Throws:
PDFException

loadFDF

public void loadFDF(String fileName)
             throws PDFException
Load an FDF file. This method will open the corresponding PDF file and import the FDF data in the document.

Parameters:
fileName - Name of the FDF document file.
Throws:
PDFException

loadXFDF

public void loadXFDF(String fileName)
              throws PDFException
Load an XFDF file. This method will open the corresponding PDF file and import the XFDF data in the document.

Parameters:
fileName - Name of the xFDF document file.
Throws:
PDFException

loadPDF

public void loadPDF(String fileName)
             throws PDFException
Load and display a PDF document using a file name.

Overrides:
loadPDF in class PDFViewerBean
Parameters:
fileName - Name of the PDF document file.
Throws:
PDFException

loadPDF

public void loadPDF(URL url)
             throws PDFException
Load and display a PDF document using a URL.

Overrides:
loadPDF in class PDFViewerBean
Parameters:
url - URL pointing to the location of the PDF document.
Throws:
PDFException

print

public void print(PrintSettings printSettings)
           throws PDFPermissionException,
                  PrinterException
Description copied from class: PDFViewerBean
Prints the PDF document to a printer. This method will first prompt the user to choose a system printer and then it will print the document.

If finer control of printing is necessary, the IPDFDocument object return by the getDocument() method implements both Printable and Pageable. The host application can then create its own PrinterJob and set any settings necessary, then call either setPageable or setPrintable with the IPDFDocument object and then start the print job.

Overrides:
print in class PDFViewerBean
Parameters:
printSettings - Print job settings. Use this object to tell jPDFViewer how to print the document. If null, the library will print using default settings.
Throws:
PDFPermissionException
PrinterException

setPDFSaver

public void setPDFSaver(IPDFSaver saver)
This method allows the host application to override the default PDF Saver, the class that saves the document when the save toolbar button is pressed.

Parameters:
saver - A reference to an object that implements the IPDFSaver interface.

addPDFListener

public void addPDFListener(IPDFListener listener)
Adds a PDF Listener object to receive notifications when a new document is opened.

Parameters:
listener - The new listener.

removePDFListener

public boolean removePDFListener(IPDFListener listener)
Removes a PDF Listener object.

Parameters:
listener - The new listener.
Returns:
true if the listener was removed, false otherwise

getCurrentDocName

public String getCurrentDocName()
Deprecated. Use getDocument().getPDFSource().getName()

This method returns the current document name. The name changes according to whether the document was opened from a file (name of the file), a URL (the URL file) or from an input stream ("untitled" @see PDFNotesBean#UNTITLED).

Returns:
The name of the current document.

getCurrentDocPath

public String getCurrentDocPath()
Deprecated. Use getDocument().getPDFSource().getPath()

This method returns the current document path. The name changes according to whether the document was opened from a file (absolute path of the file), a URL (the URL) or from an input stream ("untitled" @see PDFNotesBean#UNTITLED).

Returns:
The path of the current document.

setModified

public void setModified(boolean modified)
Flag this document as modified. If the host application modifies the document programmatically, it should call this method to flag the document as modified. Methods such as open and close check this flag to decide whether to prompt the user to save the current document or not.

Parameters:
modified - Flag indicating whether this document has been modified.

isModified

public boolean isModified()
Returns whether this document has been modified or not.

Returns:
true if the document has changed, false otherwise.

documentChanged

public void documentChanged(DocumentEvent de)
Internal method, do not use.

Specified by:
documentChanged in interface IDocumentListener
Overrides:
documentChanged in class PDFViewerBean

stopWidgetEditing

public void stopWidgetEditing()
Stops any field editing currently in progress. This method removes the focus from any field that is currently being edited and commits the value to the field.


addAnnotation

public void addAnnotation(Annotation newAnnot,
                          int pageIndex)
                   throws PDFException
Add an annotation to the document programmatically. Using this method, the host application can add annotations to the document without user interaction.

Parameters:
newAnnot - The new annotation.
pageIndex - The page at which to add the annotation, pageIndex starts at 0.
Throws:
PDFException

addAnnotation

public void addAnnotation(Annotation newAnnot,
                          int pageIndex,
                          boolean setRotation)
                   throws PDFException
Add an annotation to the document programmatically. Using this method, the host application can add annotations to the document without user interaction.

Parameters:
newAnnot - The new annotation.
pageIndex - The page at which to add the annotation, pageIndex starts at 0.
setRotation - Set false if the annotation should not be oriented according to the page's rotation
Throws:
PDFException

addSignatureField

public SignatureField addSignatureField(String fieldName,
                                        Rectangle2D bounds,
                                        int pageIndex)
                                 throws PDFException
Add a signature field to a page in the currently loaded document. Signature fields are used to digitally sign PDF documents. When this method is called, an empty signature field is added that can be signed by a user. To sign the document programmatically, the host application can call signDocument.

Parameters:
fieldName - The name of the field.
bounds - The bounds on the page for the field. If bounds are set to (0,0,0,0) then the signature is invisible.
pageIndex - The page number.
Throws:
PDFException

addSignatureField

public void addSignatureField()
This method starts the signature field creation process. The user is able to use the mouse to draw a signature field on the document. This method is called when the signature button is pressed on the toolbar.


signDocument

public void signDocument(SignatureField signField)
                  throws PDFException
Starts the signing GUI for a given signature field. This method will display a number of dialogs to the user to to choose a PKCS#12 file and to get any additional information needed to sign the document. After the signature is applied, the method will save the document to the same file or to a new file according to what the user chose.

Parameters:
signField - The signature field to apply the signature to.
Throws:
PDFException

signDocument

public void signDocument(SignatureField signField,
                         SigningInformation signingInfo,
                         File outputFile)
                  throws PDFException
This method will sign and save the document. The signature information is passed in to the method, so the method does not prompt the user for any additional information. After signing, the document will be saved to outputFile.

Parameters:
signField - The signature field to apply the signature to.
signingInfo - The signature information.
outputFile - The output file to save the document to. If this is null, the document will be saved to the current file.
Throws:
PDFException

handleAction

public void handleAction(Action action)
This method overrides the PDFViewerBean handleAction to take care of actions that are specific to jPDFNotes, such as saving the document. This method can be further overridden to handle actions in a custom manner. The parameter passed in will be an instance of an object derived from Action and can be tested using 'instanceof' to determine the kind of action.

Specified by:
handleAction in interface IPDFActionHandler
Overrides:
handleAction in class PDFViewerBean
Parameters:
action - Object describing the action.

setPageRotation

public void setPageRotation(int pageIndex,
                            int degrees)
                     throws PDFException
Deprecated. This method has moved to the MutableDocument interface.

Changes the page's rotation. This method changes the actual page rotation property which will be retained when the document is saved.

Parameters:
pageIndex - The page index, 0 based.
degrees - The new page rotation, in degrees
Throws:
PDFException

getPageRotation

public int getPageRotation(int pageIndex)
Deprecated. This method has moved to the MutableDocument interface.

Returns the rotation of this page in degrees. This is the rotation setting in the page in the PDF document, NOT in the current view.

Parameters:
pageIndex - The page index, 0 based.
Returns:
int Page rotation in degrees.

openFile

public void openFile(PDFViewerBean viewerBean)
              throws PDFException
This method is called whenever the user presses the file open button. This implementation of the method overrides the PDFViewerBean implementation to allow opening JPEG, TIFF and PNG files.

Specified by:
openFile in interface IPDFOpener
Overrides:
openFile in class PDFViewerBean
Parameters:
viewerBean - The PDFViewerBean object that initiated the open file action.
Throws:
PDFException

loadDocument

public void loadDocument(InputStream inStream,
                         String formatName)
                  throws PDFException,
                         IOException
Open a document from an input stream. This method will take different document types. Use the predefined constants DOCTYPE_* to tell the method what type of contents the input stream has.

Parameters:
inStream - The input stream to read the document from.
formatName - The name of the format of the input content data. Valid format names are pdf, tiff, tif, png, jpg, jpeg and jpe and are case insensitive.
Throws:
PDFException
IOException

loadFile

public void loadFile(String fileName)
              throws PDFException,
                     IOException
Deprecated. Use loadDocument (String fileName) instead

Method to open files of PDF, JPEG, TIFF and PNG types. the method will look at the file extension to determine how to open the file. If an image file, the file is converted to PDF and then displayed. When this files are saved, the bean can only save as PDF.

Parameters:
fileName - The name of the file to open.
Throws:
PDFException
IOException

loadDocument

public void loadDocument(String fileName)
                  throws PDFException,
                         IOException
Method to open files of PDF, JPEG, TIFF and PNG types. the method will look at the file extension to determine how to open the file. If an image file, the file is converted to PDF and then displayed. When this files are saved, the bean can only save as PDF.

Parameters:
fileName - The name of the file to open.
Throws:
PDFException
IOException

loadTextDocument

public void loadTextDocument(String fileName,
                             TextToPDFSettings settings)
                      throws PDFException,
                             IOException
Method to open text files . The file is converted to PDF and then displayed. When these files are saved, the bean can only save as PDF.

Parameters:
fileName - The name of the file to open.
settings - The settings to use when converting the text file to PDF.
Throws:
PDFException
IOException

isOpenPDFOnly

public boolean isOpenPDFOnly()
Returns whether the user is allowed to open PDF files only.

Returns:
Flag indicating whether the user is allowed to open PDF files only.

setOpenPDFOnly

public void setOpenPDFOnly(boolean openPDFOnly)
Sets a flag to determine whether the user can open PDF files only, or is allowed to open image files in JPEG, TIFF or PNG formats. This flag is used in setting the filters for the file chooser dialog.

Parameters:
openPDFOnly - The new value of the flag.

getNotesContextMenu

public PageViewContextMenuNotes getNotesContextMenu()
Deprecated. Use getPageViewPanel.getPageContextMenu()

Returns the ContextMenu used for the page view.

Returns:
the PageViewContextMenuNotes

keyPressed

public void keyPressed(KeyEvent e)
Description copied from class: PDFViewerBean
Handle key pressed events. PDFViewerBean handles page up and page down events to let the user scroll up and down the document using these keys.

Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class PDFViewerBean

canPaste

public boolean canPaste()
Look at the contents of the system clipboard and determine if the object in the clipboard can be pasted into jPDFNotes.

Returns:
Flag indicating whether the object in the clipboard can be pasted into jPDFNotes.

paste

public void paste()
this method checks the clipboard and pastes any object that it can handle into the document. Currently, the method can only paste annotations, which are placed on the clipboard when the user presses the Ctrl+C key.


startMeasurementCalibration

public void startMeasurementCalibration()
This method begins the process of calibrating the scale used with the Distance, Perimeter, and Area measuring tools. When this method is called, the user will be prompted to select a start and end point and then be prompted for the distance that measurement should be. The scale will be calculated and will be reflected in any subsequent measurements.

This method does nothing if a document is open since this feature requires a document.


getAnnotationManager

public IAnnotationManager getAnnotationManager()
Description copied from class: PDFViewerBean
Returns the annotation manager for this PDFViewerBean.

Overrides:
getAnnotationManager in class PDFViewerBean
Returns:
The annotation manager for this PDFViewerBean

isCreateTempOnSave

public boolean isCreateTempOnSave()
Returns whether or not a temporary file will be created during a save operation.

Returns:
if temporary file should created during save operation.

setCreateTempOnSave

public void setCreateTempOnSave(boolean createTempOnSave)
Sets whether or not a temporary file is to be created during a save operation when saving over an existing file. By default, a temporary file is used. This flag only applies when saving to the local files system using the default PDF Saver.

Parameters:
createTempOnSave - Flag indicating whether to use a temporary file, true by default.

getPageViewPanelNotes

public PageViewPanelNotes getPageViewPanelNotes()
Returns an interface to allow access to the page view panel. The interface provides methods to access the PopupMenus which appear on the page.

Returns:
Interface to the page view panel

getCommentPanelNotes

public CommentPanelNotes getCommentPanelNotes()
Returns an interface to allow access to the comment panel. The interface provides methods to access the annotations' context menu, the panel's toolbar, and the list of comments / annotations. Note that this method returns the same member variable as getCommentPanel(), but this method specifies that the return implements CommentPanelNotes

Returns:
Interface to the comments panel

getSignaturePanelNotes

public SignaturePanelNotes getSignaturePanelNotes()
Returns an interface to allow access to the signature panel. Note that this method returns the same member variable as getSignaturePanel(), but this method specifies that the return implements SignaturePanelNotes

Returns:
Interface to the signature panel

activateOCR

public JButton activateOCR()
Activates the OCR function for this PDFNotesBean. A button is added to the PDFToolbar that initiates the OCR function.

Returns:
the button used to initiate the OCR function

getWidgetHandler

public WidgetHandler getWidgetHandler()

Returns the WidgetHandler to be used to set the value to a FormField when its corresponding WidgetComponent is modified.

The returned WidgetHandlerNotes uses Commands so changes to a field's value can be undone.

Overrides:
getWidgetHandler in class PDFViewerBean
Returns:
WidgetHandlerNotes

getAnnotPropertiesToolBar

public AnnotPropertiesToolbar getAnnotPropertiesToolBar()
Returns the AnnotPropertiesToolbar used to modify common annotation properties.

Returns:
the AnnotPropertiesToolbar

getAnnotAlignmentToolBar

public AnnotAlignmentToolbar getAnnotAlignmentToolBar()
Returns the AnnotAlignmentToolbar used to align selected annotations

Returns:
the AnnotAlignmentToolbar

getUndoManager

public UndoManager getUndoManager()
Returns the UndoManager for this PDFNotesBean.

Returns:
the UndoManager for this PDFNotesBean