Package org.jpedal.examples.viewer
Class Commands
java.lang.Object
org.jpedal.examples.viewer.Commands
Commands
This class contains code to execute the actual commands : Access PDF Viewer features from your code.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intShow the About dialog with the version details.static final intDebug command that turns off hardware acceleration for screen rendering and repaints.static final intDebug command that turns on hardware acceleration for screen rendering and repaints.static final intShow 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 intShow 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 intstatic final intDebug command that toggles whether the mouse cursor is always shown.static final intToggle auto scrolling, which scrolls the view when the mouse is dragged past its edge.static final intGo back to the previous view in the history added byADDVIEW.static final intGo back 1 page.static final intShow a dialog to export a range of pages as images.static final intGo to the page of a bookmark.static final intOpen the JPedal pricing page in the default browser.static final intSet whether shapes and line art are recoloured along with the text when a text colour is set, then repaint.static final intIdentifies the Content menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intShow the pages in a continuous vertical column and set the mouse to pan.static final intShow the pages in a continuous column of facing pairs, fit to the page, and set the mouse to pan.static final intCopy the highlighted text to the clipboard.static final intShow 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 intShow a dialog to crop pages, then save the document (asking whether to overwrite the open file) and reopen it.static final intIdentifies the whole Swing menu bar, for showing, hiding, enabling or disabling it.static final intReturn the current page number as an Integer.static final intDebug command that makes the Viewer delete its properties file when its window is closed.static final intClear all highlighted text and images.static final intShow the document properties dialog.static final intDownsample all images using the default settings, then save the document (asking whether to overwrite the open file) and reopen it.static final intIdentifies the Edit menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intShow 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 intClose the document and the Viewer, saving the Viewer settings and warning about unsaved forms first.static final intIdentifies the Export menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intShow a preview of the selected area as an image, which can be copied or saved.booleanTrue while the Viewer is waiting for the user to drag an area to extract as an image, afterSNAPSHOT.static final intShow a dialog to extract the highlighted text.static final intShow the pages as facing pairs, fit to the page, and set the mouse to pan.static final intGo back 10 pages, stopping at the first page.static final intGo forward 10 pages, stopping at the last page.static final intIdentifies the File menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intSearch the document.static final IntegerReturned byNEXTRESULTandPREVIOUSRESULTwhen the first search result in the document is now shown.static final intGo to the first page.static final intFlatten 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 intGo forward to the next view in the history added byADDVIEW.static final intGo forward 1 page.static final intToggle full screen mode, if supported.static final intRebuild the bookmarks and return the outline (bookmarks) panel.static final intReturn the page number text field from the navigation bar.static final intReturn the thumbnail panel.static final intGo to a page.static final intIdentifies the Go To menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intOpen the JPedal documentation in the default browser.static final intNot used by the Viewer.static final intRemove the version number from the window title.static final intClear the current text highlights, then highlight areas on a page.static final intShow a dialog to extract the images embedded in a range of pages.static final intShow 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 intGo to the last page.static final intToggle the mouse between selecting text and panning the page.static final intShow 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 intOpen the next document in the recent documents list.static final intShow the next search result, wrapping round to the first result.static final intShow 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 intOpen a file.static final intOpen the current file in the operating system's default application.static final intIdentifies the Open menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intOpen a PDF from a URL.static final intOptimise 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 intReturn the number of pages in the open document as an Integer, or -1 if there is no decoder.static final intShow the pages in the page flow view, which needs JavaFX.static final intReturn the text grouping object for a page, decoding the page in the background if it is not the page being displayed.static final intIdentifies the Page Layout menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intSet the mouse to pan the page.static final intNot used by the Viewer.static final intShow a PDF portfolio's files as a detailed list.static final intShow a PDF portfolio's files as tiles.static final intIdentifies the Portfolio menu, which is only shown for PDF portfolios, in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intShow the preferences dialog.static final intOpen the previous document in the recent documents list.static final intShow the previous search result, wrapping round to the last result.static final intShow the print dialog for the open document.static final intShow 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 intShow 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 intRemove blank pages, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove all bookmarks, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove all digital signatures, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove all embedded files, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove the initial view settings, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove all JavaScript, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove all links, then save the document (asking whether to overwrite the open file) and reopen it.static final intRemove the document metadata, then save the document (asking whether to overwrite the open file) and reopen it.static final intShow a dialog to remove pages, then save the document (asking whether to overwrite the open file) and reopen it.static final intSet the colour all text is drawn in, without repainting.static final intDebug command that resets the Viewer's internal viewport scale and offsets.static final intReverse the page order, then save the document (asking whether to overwrite the open file) and reopen it.static final intRotate the display 90 degrees anticlockwise.static final intShow a dialog to rotate pages, then save the document (asking whether to overwrite the open file) and reopen it.static final intRotate the display 90 degrees clockwise.static final intRotate the display.static final intShow a dialog to save the open file.static final intShow a dialog to save the document after annotations have been added.static final intShow a dialog to scale pages, then save the document (asking whether to overwrite the open file) and reopen it.static final intSet the scaling.static final intScroll an area of a page into view.static final IntegerReturned byNEXTRESULTandPREVIOUSRESULTwhen no page has any search results.static final IntegerReturned byNEXTRESULTandPREVIOUSRESULTwhen the search wrapped round past the end or start of the document.static final intHighlight all the text on the current page.static final intToggle whether the first page is shown on its own in facing views, and save the setting.static final intSet the background colour of the display area around the pages.static final intShow 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 intSet whether lines thinner than 1 pixel are widened so they stay visible, then repaint.static final intSet whether all shapes are drawn with a 1 pixel stroke after scaling, then repaint.static final intSet whether interactive form fields are highlighted, then repaint.static final intShow 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 intSet the page background colour and repaint.static final intSet the threshold that decides which text is recoloured when a text colour is set.static final intSet the colour all text is drawn in and repaint.static final intSet the colour shown for pages that have not been drawn yet.static final intDebug command that prints the names of all form fields to standard out.static final intShow the version number in the window title.static final intShow the dialog to digitally sign the open file.static final intShow one page at a time and set the mouse to select text.static final intLet the user drag an area of the page to extract as an image.static final intShow a dialog to extract the text from a range of pages.static final intSet the mouse to select text.static final intShow the Tip of the Day dialog.static final intIdentifies the Tools menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intDebug command that callsSystem.gc().static final intShow or hide part of the Viewer's GUI.static final intIdentifies the View menu in the Swing menu bar, for showing, hiding, enabling or disabling it.static final intOpen the IDRsolutions website in the default browser.static final intNot used by the Viewer.static final intZoom in to the next preset scaling, up to 1000%.static final intZoom out to the next preset scaling, down to 25%. -
Constructor Summary
ConstructorsConstructorDescriptionCommands(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 TypeMethodDescriptionexecuteCommand(ViewerCommands command, Object[] args) Run a Viewer command.org.jpedal.examples.viewer.MouseModeGet the mouse mode, which records whether the mouse is selecting text or panning the page.org.jpedal.examples.viewer.gui.swing.SearchListReturns the searchList of the last search preformed.getValue(ViewerValues value) Get a value from the Viewer.voidhandleTransferedFile(String file) Open a file dropped onto the Viewer.static booleanisPDFLinearized(String pdfUrl) examine first few bytes to see if linearized and return true linearized filevoidRebuild the recent documents menu from the list stored in the Viewer's preferences.
-
Field Details
-
extractingAsImage
public boolean extractingAsImageTrue while the Viewer is waiting for the user to drag an area to extract as an image, afterSNAPSHOT. It is set back to false once the area has been extracted. -
ABOUT
public static final int ABOUTShow the About dialog with the version details. Does nothing if arguments are passed.- See Also:
-
BITMAP
public static final int BITMAPShow a dialog to export a range of pages as images. Does nothing if arguments are passed.- See Also:
-
IMAGES
public static final int IMAGESShow 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 TEXTShow a dialog to extract the text from a range of pages. Does nothing if arguments are passed.- See Also:
-
SAVE
public static final int SAVEShow a dialog to save the open file. Does nothing if arguments are passed.- See Also:
-
PRINT
public static final int PRINTShow the print dialog for the open document. Does nothing if arguments are passed.- See Also:
-
EXIT
public static final int EXITClose the document and the Viewer, saving the Viewer settings and warning about unsaved forms first. The JVM exits ifViewer.exitOnCloseis true. Does nothing if arguments are passed.- See Also:
-
AUTOSCROLL
public static final int AUTOSCROLLToggle 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 DOCINFOShow the document properties dialog. Does nothing if arguments are passed.- See Also:
-
OPENFILE
public static final int OPENFILEOpen 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 BOOKMARKGo to the page of a bookmark. The arg is the String bookmark title and must be passed.- See Also:
-
FIND
public static final int FINDSearch 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 ofSearchTypeflags, 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 SNAPSHOTLet 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 OPENURLOpen 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 VISITWEBSITEOpen the IDRsolutions website in the default browser. Does nothing if arguments are passed.- See Also:
-
PREVIOUSDOCUMENT
public static final int PREVIOUSDOCUMENTOpen the previous document in the recent documents list. Does nothing if arguments are passed.- See Also:
-
NEXTDOCUMENT
public static final int NEXTDOCUMENTOpen the next document in the recent documents list. Does nothing if arguments are passed.- See Also:
-
PREVIOUSRESULT
public static final int PREVIOUSRESULTShow the previous search result, wrapping round to the last result. ReturnsSEARCH_RETURNED_TO_START,SEARCH_NOT_FOUND,FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWNor null. Does nothing if arguments are passed.- See Also:
-
NEXTRESULT
public static final int NEXTRESULTShow the next search result, wrapping round to the first result. ReturnsSEARCH_RETURNED_TO_START,SEARCH_NOT_FOUND,FIRST_DOCUMENT_SEARCH_RESULT_NOW_SHOWNor null. Does nothing if arguments are passed.- See Also:
-
TIP
public static final int TIPShow the Tip of the Day dialog. Does nothing if arguments are passed.- See Also:
-
PREFERENCES
public static final int PREFERENCESShow the preferences dialog. Does nothing if arguments are passed.- See Also:
-
COPY
public static final int COPYCopy the highlighted text to the clipboard. Arguments are ignored.- See Also:
-
SELECTALL
public static final int SELECTALLHighlight all the text on the current page. Only works in single page view. Arguments are ignored.- See Also:
-
DESELECTALL
public static final int DESELECTALLClear all highlighted text and images. Only works in single page view. Arguments are ignored.- See Also:
-
UPDATEGUILAYOUT
public static final int UPDATEGUILAYOUTShow 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 MOUSEMODEToggle 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 PANMODESet the mouse to pan the page. Does nothing if arguments are passed.- See Also:
-
TEXTSELECT
public static final int TEXTSELECTSet the mouse to select text. Does nothing if arguments are passed.- See Also:
-
SEPARATECOVER
public static final int SEPARATECOVERToggle 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 EXTRACTTEXTShow a dialog to extract the highlighted text. Does nothing if arguments are passed.- See Also:
-
EXTRACTASIMAGE
public static final int EXTRACTASIMAGEShow 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 ROTATELEFTRotate the display 90 degrees anticlockwise. Arguments are ignored.- See Also:
-
ROTATERIGHT
public static final int ROTATERIGHTRotate the display 90 degrees clockwise. Arguments are ignored.- See Also:
-
OPENINSYSTEMDEFAULT
public static final int OPENINSYSTEMDEFAULTOpen 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 SIGNShow the dialog to digitally sign the open file. Does nothing if arguments are passed.- See Also:
-
FIRSTPAGE
public static final int FIRSTPAGEGo to the first page. Does nothing if arguments are passed.- See Also:
-
FBACKPAGE
public static final int FBACKPAGEGo back 10 pages, stopping at the first page. Does nothing if arguments are passed.- See Also:
-
BACKPAGE
public static final int BACKPAGEGo back 1 page. Optionally the arg is the number of pages to go back, as a String.- See Also:
-
FORWARDPAGE
public static final int FORWARDPAGEGo forward 1 page. Optionally the arg is the number of pages to go forward, as a String.- See Also:
-
FFORWARDPAGE
public static final int FFORWARDPAGEGo forward 10 pages, stopping at the last page. Does nothing if arguments are passed.- See Also:
-
LASTPAGE
public static final int LASTPAGEGo to the last page. Does nothing if arguments are passed.- See Also:
-
GOTO
public static final int GOTOGo 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 SINGLEShow 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 CONTINUOUSShow 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_FACINGShow 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 FACINGShow 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 PAGEFLOWShow the pages in the page flow view, which needs JavaFX. Does nothing if arguments are passed.- See Also:
-
FULLSCREEN
public static final int FULLSCREENToggle full screen mode, if supported. Does nothing if arguments are passed.- See Also:
-
ZOOMIN
public static final int ZOOMINZoom in to the next preset scaling, up to 1000%. Does nothing if arguments are passed.- See Also:
-
ZOOMOUT
public static final int ZOOMOUTZoom out to the next preset scaling, down to 25%. Does nothing if arguments are passed.- See Also:
-
PORTFOLIO_DETAIL
public static final int PORTFOLIO_DETAILShow a PDF portfolio's files as a detailed list. Arguments are ignored.- See Also:
-
PORTFOLIO_TILES
public static final int PORTFOLIO_TILESShow a PDF portfolio's files as tiles. Arguments are ignored.- See Also:
-
ROTATION
public static final int ROTATIONRotate 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 SCALINGSet 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 CURRENTMENUIdentifies 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 CONTENTMENUIdentifies 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 PDFMENUNot used by the Viewer. Running it as a command does nothing.- See Also:
-
EXPORTMENU
public static final int EXPORTMENUIdentifies 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 WINDOWMENUNot used by the Viewer. Running it as a command does nothing.- See Also:
-
PAGELAYOUTMENU
public static final int PAGELAYOUTMENUIdentifies 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 EDITMENUIdentifies 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 GOTOMENUIdentifies 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 VIEWMENUIdentifies 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 OPENMENUIdentifies 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 FILEMENUIdentifies 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 HELPFORUMNot used by the Viewer. The Help menu is identified byHELP. Running it as a command does nothing.- See Also:
-
PORTFOLIOMENU
public static final int PORTFOLIOMENUIdentifies 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 TOOLSMENUIdentifies 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 SAVEFORMShow 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 HIGHLIGHTClear 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 SCROLLScroll 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 ADDVIEWAdd a view to the history used byFORWARDandBACK. Args are the Integer page, the Rectangle location and the Integer scaling type.- See Also:
-
FORWARD
public static final int FORWARDGo forward to the next view in the history added byADDVIEW. Arguments are ignored.- See Also:
-
BACK
public static final int BACKGo back to the previous view in the history added byADDVIEW. Arguments are ignored.- See Also:
-
PAGECOUNT
public static final int PAGECOUNTReturn 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 CURRENTPAGEReturn the current page number as an Integer. Arguments are ignored.- See Also:
-
GETOUTLINEPANEL
public static final int GETOUTLINEPANELRebuild the bookmarks and return the outline (bookmarks) panel. Arguments are ignored.- See Also:
-
GETTHUMBNAILPANEL
public static final int GETTHUMBNAILPANELReturn the thumbnail panel. Arguments are ignored.- See Also:
-
GETPAGECOUNTER
public static final int GETPAGECOUNTERReturn the page number text field from the navigation bar. Arguments are ignored.- See Also:
-
PAGEGROUPING
public static final int PAGEGROUPINGReturn 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 SETPAGECOLORSet the page background colour and repaint. The arg is the colour as an Integer RGB value.- See Also:
-
SETUNDRAWNPAGECOLOR
public static final int SETUNDRAWNPAGECOLORSet 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 REPLACETEXTCOLORSet the colour all text is drawn in, without repainting. The arg is the colour as an Integer RGB value.SETTEXTCOLORdoes the same and repaints.- See Also:
-
SETTEXTCOLOR
public static final int SETTEXTCOLORSet 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 CHANGELINEARTSet 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 SETDISPLAYBACKGROUNDSet 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 SETREPLACEMENTCOLORTHRESHOLDSet 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 SETENHANCEFRACTIONALLINESSet 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 SETHIDELINEWEIGHTSSet 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 SETHIGHLIGHTFORMFIELDSSet whether interactive form fields are highlighted, then repaint. The arg is a Boolean.- See Also:
-
HIDEVERSIONNUMBER
public static final int HIDEVERSIONNUMBERRemove the version number from the window title. Arguments are ignored.- See Also:
-
SHOWVERSIONNUMBER
public static final int SHOWVERSIONNUMBERShow the version number in the window title. Arguments are ignored.- See Also:
-
HELP
public static final int HELPOpen the JPedal documentation in the default browser. Does nothing if arguments are passed.- See Also:
-
BUY
public static final int BUYOpen the JPedal pricing page in the default browser. Does nothing if arguments are passed.- See Also:
-
RESET
public static final int RESETDebug command that resets the Viewer's internal viewport scale and offsets. Does nothing if arguments are passed.- See Also:
-
ACCELERATIONON
public static final int ACCELERATIONONDebug command that turns on hardware acceleration for screen rendering and repaints. Does nothing if arguments are passed.- See Also:
-
ACCELERATIONOFF
public static final int ACCELERATIONOFFDebug command that turns off hardware acceleration for screen rendering and repaints. Does nothing if arguments are passed.- See Also:
-
SHOWFORMNAMES
public static final int SHOWFORMNAMESDebug 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 DELETEPROPERTIESONEXITDebug 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 ALWAYSSHOWMOUSEDebug command that toggles whether the mouse cursor is always shown. Does nothing if arguments are passed.- See Also:
-
TRIGGERGC
public static final int TRIGGERGCDebug command that callsSystem.gc(). Does nothing if arguments are passed.- See Also:
-
ADDPAGE
public static final int ADDPAGEShow 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 ADDIMAGEShow 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 COPYPAGEShow 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 CROPPAGEShow 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 EMBEDFILEShow 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 ISOLATEPAGEShow 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 NUPShow 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 REMOVEPAGEShow 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 ROTATEPAGEShow 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 SCALEPAGEShow 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 SETDOCUMENTINFOShow 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 SETINITIALVIEWShow 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 REMOVEBOOKMARKSRemove 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 REMOVEEMBEDDEDFILESRemove 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 REMOVEINITIALVIEWRemove 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 REMOVEJAVASCRIPTRemove all JavaScript, then save the document (asking whether to overwrite the open file) and reopen it. Does nothing if arguments are passed.- See Also:
-
REMOVELINKS
public static final int REMOVELINKSRemove all links, 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 REMOVEMETADATARemove 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 MOVEPAGEShow 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 REMOVEANNOTATIONSShow 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 REVERSEPAGESReverse 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 REDACTShow 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 DOWNSAMPLEIMAGESDownsample 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 FLATTENLAYERSFlatten 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 OPTIMIZECOLORPALETTEOptimise 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 REMOVEBLANKPAGESRemove 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 REMOVEDIGITALSIGNATURESRemove 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
Returned byNEXTRESULTandPREVIOUSRESULTwhen the first search result in the document is now shown. -
SEARCH_RETURNED_TO_START
Returned byNEXTRESULTandPREVIOUSRESULTwhen the search wrapped round past the end or start of the document. -
SEARCH_NOT_FOUND
Returned byNEXTRESULTandPREVIOUSRESULTwhen 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 pagecurrentGUI- the Swing GUI the commands act ondecode_pdf- the decoder displaying the PDFthumbnails- the thumbnail panelproperties- the Viewer's preferencessearchFrame- the search window used by the find and search result commands
-
-
Method Details
-
executeCommand
Run a Viewer command. A null, empty or single-nullargsarray is treated as no arguments, which for most commands means they use the current Viewer state or show a dialog. If aJPedalActionHandlerhas been registered for the command withOptions.JPedalActionHandlers, that handler is run instead and null is returned.- Parameters:
command- the command to runargs- the arguments for the command, or null- Returns:
- the command's result for commands that return one (such as
PAGECOUNTor the search result commands), otherwise null
-
getValue
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
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
examine first few bytes to see if linearized and return true linearized file- Parameters:
pdfUrl- is of type String- Returns:
- the isLinear
-