<< View previous version | view page history | view next version >>
The ICEpdf Viewer is a reference implementation (RI) of a standalone PDF viewer application. You can use it as is, or as a starting point for your own custom application.
The application uses the SwingViewBuilder object to create the GUI elements in the viewer application, such as the toolbar and menu system. These GUI elements, including the page view, are controlled by the SwingController object which produces a rich viewer application that can be used as is in most implementations.
The source-code for the ICEpdf Viewer Application is located in the [install_dir]/icepdf/viewer/ directory.
- [Starting the ICEpdf Viewer Application]
- [Starting as an Executable JAR]
- [Command Line Options]
- [Settings Directory]
- [Using the ICEpdf Viewer]
- [Opening PDF Files]
- [The ICEpdf Viewer Work Area]
- [Navigating Within a PDF File]
- [Document Manipulation]
- [Keyboard and Mouse Manipulation]
- [Searching for Text]
- [Working with Annotations]
- [Displaying Document Permissions and Information]
- [Exporting a PDF File to SVG]
- [Exporting a PDF File to Text]
- [Printing a PDF File]
- [Saving a PDF File]
- [Closing a PDF File]
- [Exiting the ICEpdf Viewer Application]
Starting the ICEpdf Viewer Application
1. Ensure that JDK 1.5.0 or higher has been installed.
2. Add the relevant JAR files to the classpath. You need at least the following:
- icepdf-core.jar
- icepdf-viewer.jar
To enable ICEpdf Pro and full PDF font support, install the following:
- icepdf-pro.jar
- icepdf-pro-intl.jar
To enable exporting to SVG, you also require the following Batik JAR files:
- batik-awt-util.jar
- batik-dom.jar
- batik-svg-dom.jar
- batik-svggen.jar
- batik-util.jar
- batik-xml.jar
For more information, see [Batik Library for SVG Support].
3. Run "java org.icepdf.core.ri.viewer.Main [option <value>]"
Starting as an Executable JAR
The ri_pdf.jar file is an executable JAR file, so you can also start the Viewer Application with JDK 1.5.0 or greater as follows: "java -jar icepdf-viewer.jar"
Command Line Options
Option | Description |
-loadfile filename | Starts the ICEpdf Viewer and displays the specified local PDF file. Use the following syntax: -loadfile c:/examplepath/file.pdf |
-loadurl url | Starts the ICEpdf Viewer and displays the PDF file at the specified URL. Use the following syntax: -loadurl http://www.examplesite.com/file.pdf |
To start the ICEpdf Viewer without command line options or Batik support:
"java -classpath icepdf-core.jar; icepdf-viewer.jar org.icepdf.core.ri.viewer.main"
Settings Directory
The ICEpdf Viewer stores its settings in the directory:
<user_dir>/.icesoft/icepdf_viewer
...where <user_dir> is the platform-specific directory specified by the user.home system property.
Using the ICEpdf Viewer
This section describes how to use the ICEpdf Viewer application to do the following:
- Open PDF files
- Understand the ICEpdf Viewer work area
- Navigate and manipulate the view of a PDF document
- Export, save, and print the contents of a PDF document
- Exit a document and the application
Opening PDF Files
You can open a PDF file from the local file system or from a URL.
To open a local PDF file
- Launch your ICEpdf application (if it is not already running).
- Click File > Open > File (in the menu).
- In the Open dialog box, select a PDF file and click Open.
To open a PDF from a URL
- Launch ICEpdf.
- Select File > Open > URL (in the menu).
- In the Open URL dialog box, type the URL of a PDF file in the form
http://www.icepdf.org/resources/DevelopersGuide.pdf and click OK.
To open a PDF using Drag and Drop
You can open a PDF file by dragging it from your file system onto the Viewer application window. You can also drag and drop multiple files at once.
Furthermore, some applications allow you to drag and drop URL text strings. If you drag a URL pointing to a PDF file onto the Viewer application, that file is opened. The text string must contain an http://* *prefix and a **.pdf{*} reference.
Note If a file is password protected and security support has been configured, a password dialog is displayed. You have three attempts to enter the correct password, after which an error message is displayed. If the file has other security settings, such as "No Printing", the ICEpdf Viewer respects those settings. |
Opening Multiple PDF Files
The ICEpdf Viewer implements a Single Document Interface (SDI) for viewing PDF files. Multiple PDF files can be viewed at the same time, each in its own application window. Some MDI functionality has been included in the Window menu, which allows the user to switch between each open Viewer window, minimize all Viewer windows, and bring all Viewer windows to the front.
An additional ICEpdf Viewer window is opened automatically when you open another PDF file.
The ICEpdf Viewer Work Area
The ICEpdf Viewer consists of the following four distinct work areas:
- Main toolbar - provides controls and buttons to navigate and work with a PDF file.
- Document pane - displays a PDF file.
- Utility pane - has a bookmark tab which lets you browse a PDF file using a documents bookmarks and a search tab which enables you to search for text in a file.
- View toolbar - allows you to change the way a document's pages are displayed in the document pane.
Figure 2 ICEpdf Viewer Work Area
About the ICEpdf Viewer Main Toolbar
The toolbar has shortcuts for many common functions, but you can hide it to have a larger display area.
To show or hide the toolbar, select View > Show Toolbar or View > Hide Toolbar. The toolbar provides access to the view and navigation functionality.
Figure 3 ICEpdf Toolbar
From left to right, the toolbar contains:
|
|
|
|
|
|
|
View Toolbar
The view toolbar contains four buttons that allow you to change how a PDF document is displayed.
From left to right:
- Facing Page View Continuous
- Facing Page View Non-continuous
- Single Page View Continuous
- Single Page View Non-continuous
About the Utility/Bookmark Pane
You can show or hide the utility pane, which contains tabs for a document's bookmarks and for the search function. If the file does not have any bookmarks, the bookmarks tab is not displayed.
To show or hide the utility pane, select View > Show Utility Pane or View > Hide Utility Pane. Alternatively, if the toolbar is displayed, you can click the Show/Hide Utility Pane button.
Navigating Within a PDF File
Using Bookmarks
If a PDF file has been created with bookmarks, you can use the bookmarks like a table of contents to choose what you want to view.
Bookmarks are displayed on a tab in the utility pane on the left side of the Viewer. However, they are not displayed if View > Hide Utility Pane has been selected.
Viewing a Bookmark Topic
To view a bookmark topic, click the bookmark topic name:
Viewing More Bookmark Topics
If a bookmark has a + symbol beside it, you can expand a parent bookmark topics to reveal its children. Similarly, click the - symbol next to a bookmark to collapse a parent bookmark and hide its children.
Viewing the Next or Previous Page
- To view the next page of a PDF file, select Document > Next Page.
- To view the previous page of a PDF file, select Document > Previous Page. Using the toolbar, select the Next Page or Previous Page buttons to navigate.
Viewing the First or Last Page
- To view the first page of a PDF file, select Document > First Page.
- To view the previous page of a PDF file, select Document > Last Page. Using the toolbar, select the First Page or Last Page buttons to navigate.
Viewing a Specific Page
To view a specific page of a PDF file:
1. Select Document > Go To Page.
2. In the Go To Page dialog, select a page number and click OK.
Using the toolbar, type a page number in the page number field and press Enter.
Document Manipulation
Zooming In and Out
You can zoom in on a page to get a closer view, and you can zoom out for a smaller view:
- To zoom in on a page, select View > Zoom In. You can zoom in repeatedly to get a closer view.
- To zoom out from a page, select View > Zoom Out. You can zoom out repeatedly to get a smaller view.
Using the toolbar, select the Zoom In or Zoom Out buttons. You can select a magnification percentage from the Zoom drop-down selection box, or type a value in the Zoom box and press Enter.
Select the Zoom In Tool or Zoom Out Tool to simply click to zoom in or out on an area of the PDF file
Viewing a PDF File in its Original Size or to Fit the Window
- To view the PDF file in its actual size, select View > Actual Size. The actual size is the size of the page as it was originally created.
- To view the PDF file so that the entire page is visible, select View > Fit in Window.
- To view the PDF file so that the width of the page fills the window size, select View > Fit Width.
Using the toolbar, click the Actual Size, Fit in Window, and Fit Width buttons.
Rotating a PDF File
If the PDF file is displayed sideways, you can rotate it so that it is easier to view or read.
To rotate the PDF file, select View > Rotate Left or View > Rotate Right. The view is rotated 90 degrees clockwise or counter-clockwise each time you select it. Using the toolbar, click the Rotate Left and Rotate Right buttons.
Keyboard and Mouse Manipulation
While viewing a PDF, you can use the following keyboard and mouse actions:
Keyboard or Mouse Action | Result |
Page Up / Page Down | Scrolls the current page up/down. If the top/bottom of the page is reached, the view changes to the previous/next page in the document. |
Arrow keys | Scrolls the display in the direction of the arrow key pressed. If the top/bottom of the page is reached, the view changes to the previous/next page in the document. |
Mouse click | If the Zoom In tool is selected, zooms in. If the Zoom Out tool is selected, zooms out. |
Mouse click and drag | If the Pan Tool is selected (the default), pans the display in the direction the mouse is dragged. |
Keyboard or Mouse Action | Result |
Mouse wheel | If you are using JDK 1.4 or higher, pages can be scrolled using the mouse scroll wheel. If the top/bottom of the page is reached, the view changes to the previous/next page in the document. |
Searching for Text
If a PDF file contains text, you can search for text strings within it using the Search function.
The Search function is displayed on a tab in the utility pane on the left side of the Viewer. However, it is not displayed if the Utility Pane is hidden. In this case, select Document > Search or click the Search Document button to open the Search tab.
To search for a text string, type it in the Search Text field and click Search. The results are displayed in the Results field, indicating how many hits were found on each page of the document. You can then click on an entry in the Result field to go directly to that page.
Working with Annotations
The Viewer RI is able to display and add / edit / remove Link annotations from a PDF document.
To view, edit, or delete an existing annotation, first use the Select Tool to select an existing annotation. Once an annotation is selected:
- It's properties will be displayed in the Annotations pane of the Utility Panel. These can be edited directly in the Annotations pane.
- It can be moved via dragging it to a new location on the page with the mouse.
- It can be deleted/removed by pressing the Delete key, or the Ctrl-D / Cmd-D key (OS X).
To create a new annotation, use the Link Annotation Tool. With the tool selected, the mouse can be used to select a rectangular region on the page that will form the extent of the new link annotation. Once the region is defined, the Annotations pane in the Utility Panel can be used to define its attributes.
Displaying Document Permissions and Information
To display security information about an open PDF document, such as the security method and which security features are enabled, select File > Document Permissions.
To display other information about an open PDF document, such as the creator and modification dates, select File > Document Information.
Exporting a PDF File to SVG
SVG support is available if you have configured the optional Batik SVG library. For more information, see [Batik Library for SVG Support].
To export a PDF file as an SVG file
- If Batik is configured, select File > Export SVG.
- In the Export as SVG dialog, specify a location and filename and click OK.
Exporting a PDF File to Text
You can export the text in a PDF to a text file.
To export a PDF file as a text file:
- Select File > Export Text.
- In the Export Document Text dialog, specify a location and filename and click OK.
Printing a PDF File
To print a PDF file with a printer dialog, select File > Print.
Alternatively, from the toolbar, click the (Print button) to print a PDF file without displaying a print dialog.
To set the paper, orientation and margin settings before printing the file, select File > Print Setup.
Saving a PDF File
To save a copy and any annotation related changes of the PDF file you are viewing:
- Select File > Save As.
- In the Save As dialog box, navigate to a location for the file, type a unique filename and click OK.
Closing a PDF File
To close the PDF file you are viewing, leaving the application open, select File > Close.
Exiting the ICEpdf Viewer Application
To exit from the ICEpdf Viewer and close any open files, select File > Exit.