Class Commands

java.lang.Object
org.jpedal.examples.viewer.Commands

public class Commands extends Object

Commands


This class contains code to execute the actual commands : Access PDF Viewer features from your code.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Show the About dialog with the version details.
    static final int
    Debug command that turns off hardware acceleration for screen rendering and repaints.
    static final int
    Debug command that turns on hardware acceleration for screen rendering and repaints.
    static final int
    Show a dialog to choose pages and an image, then let the user drag the area to place it in, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Show a dialog to insert blank pages of a chosen size, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Add a view to the history used by FORWARD and BACK.
    static final int
    Debug command that toggles whether the mouse cursor is always shown.
    static final int
    Toggle auto scrolling, which scrolls the view when the mouse is dragged past its edge.
    static final int
    Go back to the previous view in the history added by ADDVIEW.
    static final int
    Go back 1 page.
    static final int
    Show a dialog to export a range of pages as images.
    static final int
    Go to the page of a bookmark.
    static final int
    Open the JPedal pricing page in the default browser.
    static final int
    Set whether shapes and line art are recoloured along with the text when a text colour is set, then repaint.
    static final int
    Identifies the Content menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Show the pages in a continuous vertical column and set the mouse to pan.
    static final int
    Show the pages in a continuous column of facing pairs, fit to the page, and set the mouse to pan.
    static final int
    Copy the highlighted text to the clipboard.
    static final int
    Show a dialog to copy a page to another position, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Show a dialog to crop pages, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Identifies the whole Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Return the current page number as an Integer.
    static final int
    Debug command that makes the Viewer delete its properties file when its window is closed.
    static final int
    Clear all highlighted text and images.
    static final int
    Show the document properties dialog.
    static final int
    Downsample all images using the default settings, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Identifies the Edit menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Show a dialog to embed a file in the document as an attachment, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Close the document and the Viewer, saving the Viewer settings and warning about unsaved forms first.
    static final int
    Identifies the Export menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Show a preview of the selected area as an image, which can be copied or saved.
    boolean
    True while the Viewer is waiting for the user to drag an area to extract as an image, after SNAPSHOT.
    static final int
    Show a dialog to extract the highlighted text.
    static final int
    Show the pages as facing pairs, fit to the page, and set the mouse to pan.
    static final int
    Go back 10 pages, stopping at the first page.
    static final int
    Go forward 10 pages, stopping at the last page.
    static final int
    Identifies the File menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Search the document.
    static final Integer
    Returned by NEXTRESULT and PREVIOUSRESULT when the first search result in the document is now shown.
    static final int
    Go to the first page.
    static final int
    Flatten all layers, removing hidden layers and making visible layers permanent, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Go forward to the next view in the history added by ADDVIEW.
    static final int
    Go forward 1 page.
    static final int
    Toggle full screen mode, if supported.
    static final int
    Rebuild the bookmarks and return the outline (bookmarks) panel.
    static final int
    Return the page number text field from the navigation bar.
    static final int
    Return the thumbnail panel.
    static final int
    Go to a page.
    static final int
    Identifies the Go To menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Open the JPedal documentation in the default browser.
    static final int
    Not used by the Viewer.
    static final int
    Remove the version number from the window title.
    static final int
    Clear the current text highlights, then highlight areas on a page.
    static final int
    Show a dialog to extract the images embedded in a range of pages.
    static final int
    Show a dialog to choose pages to keep, removing all the others, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Go to the last page.
    static final int
    Toggle the mouse between selecting text and panning the page.
    static final int
    Show a dialog to move a page to another position, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Open the next document in the recent documents list.
    static final int
    Show the next search result, wrapping round to the first result.
    static final int
    Show a dialog to combine several pages onto each page in a grid of rows and columns, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Open a file.
    static final int
    Open the current file in the operating system's default application.
    static final int
    Identifies the Open menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Open a PDF from a URL.
    static final int
    Optimise image colour palettes to fit an indexed colour space, losslessly reducing image size, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Return the number of pages in the open document as an Integer, or -1 if there is no decoder.
    static final int
    Show the pages in the page flow view, which needs JavaFX.
    static final int
    Return the text grouping object for a page, decoding the page in the background if it is not the page being displayed.
    static final int
    Identifies the Page Layout menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Set the mouse to pan the page.
    static final int
    Not used by the Viewer.
    static final int
    Show a PDF portfolio's files as a detailed list.
    static final int
    Show a PDF portfolio's files as tiles.
    static final int
    Identifies the Portfolio menu, which is only shown for PDF portfolios, in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Show the preferences dialog.
    static final int
    Open the previous document in the recent documents list.
    static final int
    Show the previous search result, wrapping round to the last result.
    static final int
    Show the print dialog for the open document.
    static final int
    Show a dialog to choose pages, then let the user drag the area of text to redact, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Show a dialog to choose pages to remove annotations from, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove blank pages, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove all bookmarks, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove all digital signatures, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove all embedded files, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove the initial view settings, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove all JavaScript, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove all links, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Remove the document metadata, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Show a dialog to remove pages, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Set the colour all text is drawn in, without repainting.
    static final int
    Debug command that resets the Viewer's internal viewport scale and offsets.
    static final int
    Reverse the page order, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Rotate the display 90 degrees anticlockwise.
    static final int
    Show a dialog to rotate pages, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Rotate the display 90 degrees clockwise.
    static final int
    Rotate the display.
    static final int
    Show a dialog to save the open file.
    static final int
    Show a dialog to save the document after annotations have been added.
    static final int
    Show a dialog to scale pages, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Set the scaling.
    static final int
    Scroll an area of a page into view.
    static final Integer
    Returned by NEXTRESULT and PREVIOUSRESULT when no page has any search results.
    static final Integer
    Returned by NEXTRESULT and PREVIOUSRESULT when the search wrapped round past the end or start of the document.
    static final int
    Highlight all the text on the current page.
    static final int
    Toggle whether the first page is shown on its own in facing views, and save the setting.
    static final int
    Set the background colour of the display area around the pages.
    static final int
    Show a dialog to edit the document information, which is written to both the Info dictionary and the XMP metadata, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Set whether lines thinner than 1 pixel are widened so they stay visible, then repaint.
    static final int
    Set whether all shapes are drawn with a 1 pixel stroke after scaling, then repaint.
    static final int
    Set whether interactive form fields are highlighted, then repaint.
    static final int
    Show a dialog to set the page, page layout and page mode the document opens with, then save the document (asking whether to overwrite the open file) and reopen it.
    static final int
    Set the page background colour and repaint.
    static final int
    Set the threshold that decides which text is recoloured when a text colour is set.
    static final int
    Set the colour all text is drawn in and repaint.
    static final int
    Set the colour shown for pages that have not been drawn yet.
    static final int
    Debug command that prints the names of all form fields to standard out.
    static final int
    Show the version number in the window title.
    static final int
    Show the dialog to digitally sign the open file.
    static final int
    Show one page at a time and set the mouse to select text.
    static final int
    Let the user drag an area of the page to extract as an image.
    static final int
    Show a dialog to extract the text from a range of pages.
    static final int
    Set the mouse to select text.
    static final int
    Show the Tip of the Day dialog.
    static final int
    Identifies the Tools menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Debug command that calls System.gc().
    static final int
    Show or hide part of the Viewer's GUI.
    static final int
    Identifies the View menu in the Swing menu bar, for showing, hiding, enabling or disabling it.
    static final int
    Open the IDRsolutions website in the default browser.
    static final int
    Not used by the Viewer.
    static final int
    Zoom in to the next preset scaling, up to 1000%.
    static final int
    Zoom out to the next preset scaling, down to 25%.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Commands(org.jpedal.examples.viewer.Values commonValues, org.jpedal.examples.viewer.gui.SwingGUI currentGUI, PdfDecoderInt decode_pdf, org.jpedal.examples.viewer.gui.swing.SwingThumbnailPanel thumbnails, org.jpedal.examples.viewer.utils.PropertiesFile properties, org.jpedal.examples.viewer.gui.swing.SwingSearchWindow searchFrame)
    Create the command handler for a Viewer.
  • Method Summary

    Modifier and Type
    Method
    Description
    Run a Viewer command.
    org.jpedal.examples.viewer.MouseMode
    Get the mouse mode, which records whether the mouse is selecting text or panning the page.
    org.jpedal.examples.viewer.gui.swing.SearchList
    Returns the searchList of the last search preformed.
    Get a value from the Viewer.
    void
    Open a file dropped onto the Viewer.
    static boolean
    examine first few bytes to see if linearized and return true linearized file
    void
    Rebuild the recent documents menu from the list stored in the Viewer's preferences.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • extractingAsImage

      public boolean extractingAsImage
      True while the Viewer is waiting for the user to drag an area to extract as an image, after SNAPSHOT. It is set back to false once the area has been extracted.
    • ABOUT

      public static final int ABOUT
      Show the About dialog with the version details. Does nothing if arguments are passed.
      See Also:
    • BITMAP

      public static final int BITMAP
      Show a dialog to export a range of pages as images. Does nothing if arguments are passed.
      See Also:
    • IMAGES

      public static final int IMAGES
      Show a dialog to extract the images embedded in a range of pages. Does nothing if arguments are passed.
      See Also:
    • TEXT

      public static final int TEXT
      Show a dialog to extract the text from a range of pages. Does nothing if arguments are passed.
      See Also:
    • SAVE

      public static final int SAVE
      Show a dialog to save the open file. Does nothing if arguments are passed.
      See Also:
    • PRINT

      public static final int PRINT
      Show the print dialog for the open document. Does nothing if arguments are passed.
      See Also:
    • EXIT

      public static final int EXIT
      Close the document and the Viewer, saving the Viewer settings and warning about unsaved forms first. The JVM exits if Viewer.exitOnClose is true. Does nothing if arguments are passed.
      See Also:
    • AUTOSCROLL

      public static final int AUTOSCROLL
      Toggle auto scrolling, which scrolls the view when the mouse is dragged past its edge. Does nothing if arguments are passed.
      See Also:
    • DOCINFO

      public static final int DOCINFO
      Show the document properties dialog. Does nothing if arguments are passed.
      See Also:
    • OPENFILE

      public static final int OPENFILE
      Open a file. With no arguments a file chooser is shown. Otherwise, args are a File or String path, optionally followed by a String named destination to go to; an InputStream, optionally followed by a String file name; or a byte[] followed by a String file name. The file name's extension decides whether it is opened as a PDF or an image.
      See Also:
    • BOOKMARK

      public static final int BOOKMARK
      Go to the page of a bookmark. The arg is the String bookmark title and must be passed.
      See Also:
    • FIND

      public static final int FIND
      Search the document. With no arguments the search window is shown, filled in with any highlighted text. Otherwise, args are the String search term, optionally followed by all three of an Integer of SearchType flags, a Boolean for whether the term holds several words to search for separately, and a Boolean for whether to search only the current page. If all 3 optional values aren't present only the first is used.
      See Also:
    • SNAPSHOT

      public static final int SNAPSHOT
      Let the user drag an area of the page to extract as an image. Only works in single page view. Returns a Boolean that is true while waiting for the user to drag the area.
      See Also:
    • OPENURL

      public static final int OPENURL
      Open a PDF from a URL. With no arguments a dialog asks for the URL. Otherwise, the arg is the String URL.
      See Also:
    • VISITWEBSITE

      public static final int VISITWEBSITE
      Open the IDRsolutions website in the default browser. Does nothing if arguments are passed.
      See Also:
    • PREVIOUSDOCUMENT

      public static final int PREVIOUSDOCUMENT
      Open the previous document in the recent documents list. Does nothing if arguments are passed.
      See Also:
    • NEXTDOCUMENT

      public static final int NEXTDOCUMENT
      Open the next document in the recent documents list. Does nothing if arguments are passed.
      See Also:
    • PREVIOUSRESULT

      public static final int PREVIOUSRESULT
      Show the previous search result, wrapping round to the last result. Returns SEARCH_RETURNED_TO_START, SEARCH_NOT_FOUND, FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWN or null. Does nothing if arguments are passed.
      See Also:
    • NEXTRESULT

      public static final int NEXTRESULT
      Show the next search result, wrapping round to the first result. Returns SEARCH_RETURNED_TO_START, SEARCH_NOT_FOUND, FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWN or null. Does nothing if arguments are passed.
      See Also:
    • TIP

      public static final int TIP
      Show the Tip of the Day dialog. Does nothing if arguments are passed.
      See Also:
    • PREFERENCES

      public static final int PREFERENCES
      Show the preferences dialog. Does nothing if arguments are passed.
      See Also:
    • COPY

      public static final int COPY
      Copy the highlighted text to the clipboard. Arguments are ignored.
      See Also:
    • SELECTALL

      public static final int SELECTALL
      Highlight all the text on the current page. Only works in single page view. Arguments are ignored.
      See Also:
    • DESELECTALL

      public static final int DESELECTALL
      Clear all highlighted text and images. Only works in single page view. Arguments are ignored.
      See Also:
    • UPDATEGUILAYOUT

      public static final int UPDATEGUILAYOUT
      Show or hide part of the Viewer's GUI. Args are the String property name of the component and a Boolean for whether to show it. Does nothing unless exactly 2 arguments are passed.
      See Also:
    • MOUSEMODE

      public static final int MOUSEMODE
      Toggle the mouse between selecting text and panning the page. Not available in facing or page flow view. Does nothing if arguments are passed.
      See Also:
    • PANMODE

      public static final int PANMODE
      Set the mouse to pan the page. Does nothing if arguments are passed.
      See Also:
    • TEXTSELECT

      public static final int TEXTSELECT
      Set the mouse to select text. Does nothing if arguments are passed.
      See Also:
    • SEPARATECOVER

      public static final int SEPARATECOVER
      Toggle whether the first page is shown on its own in facing views, and save the setting. Does nothing if arguments are passed.
      See Also:
    • EXTRACTTEXT

      public static final int EXTRACTTEXT
      Show a dialog to extract the highlighted text. Does nothing if arguments are passed.
      See Also:
    • EXTRACTASIMAGE

      public static final int EXTRACTASIMAGE
      Show a preview of the selected area as an image, which can be copied or saved. Arguments are ignored.
      See Also:
    • ROTATELEFT

      public static final int ROTATELEFT
      Rotate the display 90 degrees anticlockwise. Arguments are ignored.
      See Also:
    • ROTATERIGHT

      public static final int ROTATERIGHT
      Rotate the display 90 degrees clockwise. Arguments are ignored.
      See Also:
    • OPENINSYSTEMDEFAULT

      public static final int OPENINSYSTEMDEFAULT
      Open the current file in the operating system's default application. Optionally the arg is a String path of a different file to open.
      See Also:
    • SIGN

      public static final int SIGN
      Show the dialog to digitally sign the open file. Does nothing if arguments are passed.
      See Also:
    • FIRSTPAGE

      public static final int FIRSTPAGE
      Go to the first page. Does nothing if arguments are passed.
      See Also:
    • FBACKPAGE

      public static final int FBACKPAGE
      Go back 10 pages, stopping at the first page. Does nothing if arguments are passed.
      See Also:
    • BACKPAGE

      public static final int BACKPAGE
      Go back 1 page. Optionally the arg is the number of pages to go back, as a String.
      See Also:
    • FORWARDPAGE

      public static final int FORWARDPAGE
      Go forward 1 page. Optionally the arg is the number of pages to go forward, as a String.
      See Also:
    • FFORWARDPAGE

      public static final int FFORWARDPAGE
      Go forward 10 pages, stopping at the last page. Does nothing if arguments are passed.
      See Also:
    • LASTPAGE

      public static final int LASTPAGE
      Go to the last page. Does nothing if arguments are passed.
      See Also:
    • GOTO

      public static final int GOTO
      Go to a page. With no arguments a dialog asks for the page number. Otherwise the arg is the page number as a String.
      See Also:
    • SINGLE

      public static final int SINGLE
      Show one page at a time and set the mouse to select text. Does nothing if arguments are passed.
      See Also:
    • CONTINUOUS

      public static final int CONTINUOUS
      Show the pages in a continuous vertical column and set the mouse to pan. Does nothing if arguments are passed.
      See Also:
    • CONTINUOUS_FACING

      public static final int CONTINUOUS_FACING
      Show the pages in a continuous column of facing pairs, fit to the page, and set the mouse to pan. Does nothing if arguments are passed.
      See Also:
    • FACING

      public static final int FACING
      Show the pages as facing pairs, fit to the page, and set the mouse to pan. Does nothing if arguments are passed.
      See Also:
    • PAGEFLOW

      public static final int PAGEFLOW
      Show the pages in the page flow view, which needs JavaFX. Does nothing if arguments are passed.
      See Also:
    • FULLSCREEN

      public static final int FULLSCREEN
      Toggle full screen mode, if supported. Does nothing if arguments are passed.
      See Also:
    • ZOOMIN

      public static final int ZOOMIN
      Zoom in to the next preset scaling, up to 1000%. Does nothing if arguments are passed.
      See Also:
    • ZOOMOUT

      public static final int ZOOMOUT
      Zoom out to the next preset scaling, down to 25%. Does nothing if arguments are passed.
      See Also:
    • PORTFOLIO_DETAIL

      public static final int PORTFOLIO_DETAIL
      Show a PDF portfolio's files as a detailed list. Arguments are ignored.
      See Also:
    • PORTFOLIO_TILES

      public static final int PORTFOLIO_TILES
      Show a PDF portfolio's files as tiles. Arguments are ignored.
      See Also:
    • ROTATION

      public static final int ROTATION
      Rotate the display. With no arguments the rotation selected in the toolbar is applied. Otherwise, the arg is the rotation in degrees as a String: 0, 90, 180 or 270.
      See Also:
    • SCALING

      public static final int SCALING
      Set the scaling. With no arguments the scaling selected in the toolbar is applied. Otherwise, the arg is the scaling as a percentage number or one of the toolbar's text options, such as "Fit Width".
      See Also:
    • CURRENTMENU

      public static final int CURRENTMENU
      Identifies the whole Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • CONTENTMENU

      public static final int CONTENTMENU
      Identifies the Content menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • PDFMENU

      public static final int PDFMENU
      Not used by the Viewer. Running it as a command does nothing.
      See Also:
    • EXPORTMENU

      public static final int EXPORTMENU
      Identifies the Export menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • WINDOWMENU

      public static final int WINDOWMENU
      Not used by the Viewer. Running it as a command does nothing.
      See Also:
    • PAGELAYOUTMENU

      public static final int PAGELAYOUTMENU
      Identifies the Page Layout menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • EDITMENU

      public static final int EDITMENU
      Identifies the Edit menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • GOTOMENU

      public static final int GOTOMENU
      Identifies the Go To menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • VIEWMENU

      public static final int VIEWMENU
      Identifies the View menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • OPENMENU

      public static final int OPENMENU
      Identifies the Open menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • FILEMENU

      public static final int FILEMENU
      Identifies the File menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • HELPFORUM

      public static final int HELPFORUM
      Not used by the Viewer. The Help menu is identified by HELP. Running it as a command does nothing.
      See Also:
    • PORTFOLIOMENU

      public static final int PORTFOLIOMENU
      Identifies the Portfolio menu, which is only shown for PDF portfolios, in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • TOOLSMENU

      public static final int TOOLSMENU
      Identifies the Tools menu in the Swing menu bar, for showing, hiding, enabling or disabling it. Running it as a command does nothing.
      See Also:
    • SAVEFORM

      public static final int SAVEFORM
      Show a dialog to save the document after annotations have been added. If no annotation has been added, no file is written. Does nothing if arguments are passed.
      See Also:
    • HIGHLIGHT

      public static final int HIGHLIGHT
      Clear the current text highlights, then highlight areas on a page. Args are an int[][] of {x, y, width, height} rectangles in PDF coordinates, the Integer page, and an optional Boolean, default true, where true highlights the rectangles and false highlights whole lines from the top left to the bottom right. With no arguments the highlights are only cleared.
      See Also:
    • SCROLL

      public static final int SCROLL
      Scroll an area of a page into view. Args are an int[] {x, y, width, height} rectangle and an optional Integer page, default the current page. Does nothing with no arguments.
      See Also:
    • ADDVIEW

      public static final int ADDVIEW
      Add a view to the history used by FORWARD and BACK. Args are the Integer page, the Rectangle location and the Integer scaling type.
      See Also:
    • FORWARD

      public static final int FORWARD
      Go forward to the next view in the history added by ADDVIEW. Arguments are ignored.
      See Also:
    • BACK

      public static final int BACK
      Go back to the previous view in the history added by ADDVIEW. Arguments are ignored.
      See Also:
    • PAGECOUNT

      public static final int PAGECOUNT
      Return the number of pages in the open document as an Integer, or -1 if there is no decoder. Arguments are ignored.
      See Also:
    • CURRENTPAGE

      public static final int CURRENTPAGE
      Return the current page number as an Integer. Arguments are ignored.
      See Also:
    • GETOUTLINEPANEL

      public static final int GETOUTLINEPANEL
      Rebuild the bookmarks and return the outline (bookmarks) panel. Arguments are ignored.
      See Also:
    • GETTHUMBNAILPANEL

      public static final int GETTHUMBNAILPANEL
      Return the thumbnail panel. Arguments are ignored.
      See Also:
    • GETPAGECOUNTER

      public static final int GETPAGECOUNTER
      Return the page number text field from the navigation bar. Arguments are ignored.
      See Also:
    • PAGEGROUPING

      public static final int PAGEGROUPING
      Return the text grouping object for a page, decoding the page in the background if it is not the page being displayed. The arg is the Integer page. Returns null with no arguments or if an error occurs.
      See Also:
    • SETPAGECOLOR

      public static final int SETPAGECOLOR
      Set the page background colour and repaint. The arg is the colour as an Integer RGB value.
      See Also:
    • SETUNDRAWNPAGECOLOR

      public static final int SETUNDRAWNPAGECOLOR
      Set the colour shown for pages that have not been drawn yet. The arg is the colour as an Integer RGB value.
      See Also:
    • REPLACETEXTCOLOR

      public static final int REPLACETEXTCOLOR
      Set the colour all text is drawn in, without repainting. The arg is the colour as an Integer RGB value. SETTEXTCOLOR does the same and repaints.
      See Also:
    • SETTEXTCOLOR

      public static final int SETTEXTCOLOR
      Set the colour all text is drawn in and repaint. The arg is the colour as an Integer RGB value.
      See Also:
    • CHANGELINEART

      public static final int CHANGELINEART
      Set whether shapes and line art are recoloured along with the text when a text colour is set, then repaint. The arg is a Boolean.
      See Also:
    • SETDISPLAYBACKGROUND

      public static final int SETDISPLAYBACKGROUND
      Set the background colour of the display area around the pages. The arg is the colour as an Integer RGB value.
      See Also:
    • SETREPLACEMENTCOLORTHRESHOLD

      public static final int SETREPLACEMENTCOLORTHRESHOLD
      Set the threshold that decides which text is recoloured when a text colour is set. The arg is the threshold as an Integer.
      See Also:
    • SETENHANCEFRACTIONALLINES

      public static final int SETENHANCEFRACTIONALLINES
      Set whether lines thinner than 1 pixel are widened so they stay visible, then repaint. The arg is a Boolean.
      See Also:
    • SETHIDELINEWEIGHTS

      public static final int SETHIDELINEWEIGHTS
      Set whether all shapes are drawn with a 1 pixel stroke after scaling, then repaint. The arg is a Boolean.
      See Also:
    • SETHIGHLIGHTFORMFIELDS

      public static final int SETHIGHLIGHTFORMFIELDS
      Set whether interactive form fields are highlighted, then repaint. The arg is a Boolean.
      See Also:
    • HIDEVERSIONNUMBER

      public static final int HIDEVERSIONNUMBER
      Remove the version number from the window title. Arguments are ignored.
      See Also:
    • SHOWVERSIONNUMBER

      public static final int SHOWVERSIONNUMBER
      Show the version number in the window title. Arguments are ignored.
      See Also:
    • HELP

      public static final int HELP
      Open the JPedal documentation in the default browser. Does nothing if arguments are passed.
      See Also:
    • BUY

      public static final int BUY
      Open the JPedal pricing page in the default browser. Does nothing if arguments are passed.
      See Also:
    • RESET

      public static final int RESET
      Debug command that resets the Viewer's internal viewport scale and offsets. Does nothing if arguments are passed.
      See Also:
    • ACCELERATIONON

      public static final int ACCELERATIONON
      Debug command that turns on hardware acceleration for screen rendering and repaints. Does nothing if arguments are passed.
      See Also:
    • ACCELERATIONOFF

      public static final int ACCELERATIONOFF
      Debug command that turns off hardware acceleration for screen rendering and repaints. Does nothing if arguments are passed.
      See Also:
    • SHOWFORMNAMES

      public static final int SHOWFORMNAMES
      Debug command that prints the names of all form fields to standard out. Does nothing if arguments are passed.
      See Also:
    • DELETEPROPERTIESONEXIT

      public static final int DELETEPROPERTIESONEXIT
      Debug command that makes the Viewer delete its properties file when its window is closed. Does nothing if arguments are passed.
      See Also:
    • ALWAYSSHOWMOUSE

      public static final int ALWAYSSHOWMOUSE
      Debug command that toggles whether the mouse cursor is always shown. Does nothing if arguments are passed.
      See Also:
    • TRIGGERGC

      public static final int TRIGGERGC
      Debug command that calls System.gc(). Does nothing if arguments are passed.
      See Also:
    • ADDPAGE

      public static final int ADDPAGE
      Show a dialog to insert blank pages of a chosen size, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • ADDIMAGE

      public static final int ADDIMAGE
      Show a dialog to choose pages and an image, then let the user drag the area to place it in, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • COPYPAGE

      public static final int COPYPAGE
      Show a dialog to copy a page to another position, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • CROPPAGE

      public static final int CROPPAGE
      Show a dialog to crop pages, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • EMBEDFILE

      public static final int EMBEDFILE
      Show a dialog to embed a file in the document as an attachment, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • ISOLATEPAGE

      public static final int ISOLATEPAGE
      Show a dialog to choose pages to keep, removing all the others, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • NUP

      public static final int NUP
      Show a dialog to combine several pages onto each page in a grid of rows and columns, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEPAGE

      public static final int REMOVEPAGE
      Show a dialog to remove pages, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • ROTATEPAGE

      public static final int ROTATEPAGE
      Show a dialog to rotate pages, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • SCALEPAGE

      public static final int SCALEPAGE
      Show a dialog to scale pages, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • SETDOCUMENTINFO

      public static final int SETDOCUMENTINFO
      Show a dialog to edit the document information, which is written to both the Info dictionary and the XMP metadata, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • SETINITIALVIEW

      public static final int SETINITIALVIEW
      Show a dialog to set the page, page layout and page mode the document opens with, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEBOOKMARKS

      public static final int REMOVEBOOKMARKS
      Remove all bookmarks, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEEMBEDDEDFILES

      public static final int REMOVEEMBEDDEDFILES
      Remove all embedded files, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEINITIALVIEW

      public static final int REMOVEINITIALVIEW
      Remove the initial view settings, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEJAVASCRIPT

      public static final int REMOVEJAVASCRIPT
      Remove all JavaScript, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEMETADATA

      public static final int REMOVEMETADATA
      Remove the document metadata, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • MOVEPAGE

      public static final int MOVEPAGE
      Show a dialog to move a page to another position, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEANNOTATIONS

      public static final int REMOVEANNOTATIONS
      Show a dialog to choose pages to remove annotations from, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REVERSEPAGES

      public static final int REVERSEPAGES
      Reverse the page order, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REDACT

      public static final int REDACT
      Show a dialog to choose pages, then let the user drag the area of text to redact, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • DOWNSAMPLEIMAGES

      public static final int DOWNSAMPLEIMAGES
      Downsample all images using the default settings, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • FLATTENLAYERS

      public static final int FLATTENLAYERS
      Flatten all layers, removing hidden layers and making visible layers permanent, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • OPTIMIZECOLORPALETTE

      public static final int OPTIMIZECOLORPALETTE
      Optimise image colour palettes to fit an indexed colour space, losslessly reducing image size, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEBLANKPAGES

      public static final int REMOVEBLANKPAGES
      Remove blank pages, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • REMOVEDIGITALSIGNATURES

      public static final int REMOVEDIGITALSIGNATURES
      Remove all digital signatures, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.
      See Also:
    • FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWN

      public static final Integer FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWN
      Returned by NEXTRESULT and PREVIOUSRESULT when the first search result in the document is now shown.
    • SEARCH_RETURNED_TO_START

      public static final Integer SEARCH_RETURNED_TO_START
      Returned by NEXTRESULT and PREVIOUSRESULT when the search wrapped round past the end or start of the document.
    • SEARCH_NOT_FOUND

      public static final Integer SEARCH_NOT_FOUND
      Returned by NEXTRESULT and PREVIOUSRESULT when no page has any search results.
  • Constructor Details

    • Commands

      public Commands(org.jpedal.examples.viewer.Values commonValues, org.jpedal.examples.viewer.gui.SwingGUI currentGUI, PdfDecoderInt decode_pdf, org.jpedal.examples.viewer.gui.swing.SwingThumbnailPanel thumbnails, org.jpedal.examples.viewer.utils.PropertiesFile properties, org.jpedal.examples.viewer.gui.swing.SwingSearchWindow searchFrame)
      Create the command handler for a Viewer. The Viewer creates this itself, so most code should get it from the Viewer rather than constructing one.
      Parameters:
      commonValues - the Viewer's shared state, such as the open file and current page
      currentGUI - the Swing GUI the commands act on
      decode_pdf - the decoder displaying the PDF
      thumbnails - the thumbnail panel
      properties - the Viewer's preferences
      searchFrame - the search window used by the find and search result commands
  • Method Details

    • executeCommand

      public Object executeCommand(ViewerCommands command, Object[] args)
      Run a Viewer command. A null, empty or single-null args array is treated as no arguments, which for most commands means they use the current Viewer state or show a dialog. If a JPedalActionHandler has been registered for the command with Options.JPedalActionHandlers, that handler is run instead and null is returned.
      Parameters:
      command - the command to run
      args - the arguments for the command, or null
      Returns:
      the command's result for commands that return one (such as PAGECOUNT or the search result commands), otherwise null
    • getValue

      public Object getValue(ViewerValues value)
      Get a value from the Viewer.
      Parameters:
      value - the value to get
      Returns:
      the page count or current page as an Integer, the open file name as a String, the scaling as a float, the page layout or the rotation as an int, or null for an unknown value
    • handleTransferedFile

      public void handleTransferedFile(String file)
      Open a file dropped onto the Viewer. Any unsaved form changes are handled first, then this waits until no other dropped file is opening and the Viewer is not processing. A message is shown if a local file does not exist.
      Parameters:
      file - the path or http/https URL of the file to open
    • recentDocumentsOption

      public void recentDocumentsOption()
      Rebuild the recent documents menu from the list stored in the Viewer's preferences.
    • getSearchList

      public org.jpedal.examples.viewer.gui.swing.SearchList getSearchList()
      Returns the searchList of the last search preformed. If currently searching this method will return the results for last completed search
      Returns:
      SearchList of all results, all data but the actual highlgiht areas
    • getMouseMode

      public org.jpedal.examples.viewer.MouseMode getMouseMode()
      Get the mouse mode, which records whether the mouse is selecting text or panning the page.
      Returns:
      the mouse mode
    • isPDFLinearized

      public static boolean isPDFLinearized(String pdfUrl)
      examine first few bytes to see if linearized and return true linearized file
      Parameters:
      pdfUrl - is of type String
      Returns:
      the isLinear