Make JPedal your default Windows PDF Viewer
JPedal’s Java PDF viewer example application can be used as your system’s default PDF viewer. To set this up, follow the three steps beneath:
- Firstly you need to create a batch file to start the PDF viewer (see beneath) and place it in your JPedal directory.
- Next you need to associate the .pdf file type with the PDF viewer. This will overwrite any existing PDF file associations (say to Acrobat), and JPedal will be used instead. (Instructions for Windows 7, Windows 8.1 and Windows 10)
- Once JPedal has been started, you can drag and drop PDF files from a file manager into the JPedal window to open them.
How to run the PDF viewer
JPedal is normally run in windows using a batch file. A batch file is a simple text file with the extension .bat . This file gives you the option of including many command line parameters that can add significant functionality and customization to the PDF viewer application. An example batch file content is listed below:
-cp c:/IDR/JPedal/bcprov-jdk14-119.jar; c:IDRJPedalcid.jar;c:IDRJPedaljpedal.jar org/jpedal/examples/viewer/Viewer %1
The batch file should be a single line without line breaks – we have separated the above statements for clarity.
Explanation of the batch file
Line one is the path to your java.exe file – remember to include the quotes if you have spaces in the file path.
Line two contains a few inbuilt Java JVM options. The -Xmx256m command allocates and amount of memory that Java can allocate to JPedal. If you are running a machine which is short of memory you may want to lower this amount. If you wish to display PDF files with extremely large and complex graphics you may want to increase this amount. The amount of memory allocated to Java in this example is 256Mb. This is a maximum amount – if the application doesn’t require it, it won’t be all used.
The -Dsun.java2d.noddraw=true completely disables the use of DirectDraw and Direct3D by Java. This avoids any problems associated with use of these APIs and their respective drivers.
Lines three and four contain special JVM options used by JPedal. A full description of the JVM options available in JPedal can be found here.
The first JVM option tells JPedal what size the screen should be (in pixels) when it opens. The second JVM Option tells JPedal the name and location of its preference file.
The next two lines contain a list of additional libraries which may be used by JPedal. None of these are essential for most pdf files, but provide additional functionality if used.
The last line of the batch file starts the JPedal PDF viewer sample application. The %1 is important as it allows you to load a PDF file into JPedal by double clicking its name from within a file manager (windows explorer).