PDFLicencePanel

Screenshot

Usage

A panel to show the PDF form of the licence of the application.

This panel can prompt the user to acknowledge the license agreement. The installation blocks until the user selects the 'agree' or 'Quit' option.

To specify the license agreement text you have to use the PDFLicencePanel.licence resource.

Example
<resources>
    <res id="PDFLicencePanel.licence" src="iz/apache-license.pdf"/>
</resources>
<panels> 
    <panel classname="PDFLicencePanel" id="panel.eula" />
</panels>
 
<jar src="deps/batik-awt-util.jar" />
<jar src="deps/batik-dom.jar" />
<jar src="deps/batik-svg-dom.jar" />
<jar src="deps/batik-svggen.jar" />
<jar src="deps/batik-util.jar" />
<jar src="deps/batik-xml.jar" />
<jar src="deps/commons-logging.jar" />
<jar src="deps/fontbox.jar" />
<jar src="deps/icepdf-core.jar" />
<jar src="deps/icepdf-viewer.jar" />
<jar src="deps/jai-codec.jar" />
<jar src="deps/jai-core.jar" />
<jar src="deps/jempbox.jar" />
<jar src="deps/pdfbox.jar" />
 

You can define multiple instances of PDFLicencePanel. For this case, the license text resource has no longer the default name, but is to be assembled from PDFLicencePanel.<panel id>.

Example
<resources>
  <res id="PDFLicencePanel.GNU" src="iz/GNU-License.pdf"/>
  <res id="PDFLicencePanel.MyLicense" src="iz/My-License.pdf"/>
</resources>
<panels> 
  <panel classname="PDFLicencePanel" id="GNU" />
  <panel classname="PDFLicencePanel" id="MyLicense" />
</panels>
...

If the id parameter is left off of the panel then the old default resource of the PDFLicencePanel.licence resource is read.

For capabilities of ICEpdf and compatibility concerns see the ICEpdf Documentation.


Since 5.0.7:

For the console installation mode, the info text can be preformatted for displaying using the following features: 

  • Word wrap
    If there are long lines in the text containing more characters than the real terminal width, the text is not broken accidentally at the terminal border, but it is wrapped at word boundaries.
    Exception: Single words which are longer than the terminal width are broken at the terminal line end.
  • Paging
    If after the word wrapping, the info text results in more lines than the real terminal height, the text is paged. The text is broken up  into a series of pages where each page fits the terminal dimensions. At the end of each text block except the last, the following is shown:

    ===More===

    indicating there are more pages of text available. The next page is shown when the SPACE or any other key is pressed.

Configuration 

The word wrap and paging feature described above must be activated depending on the format of the info text, they are deactivated by default. 

Panel configuration parameterPossible valuesDefaultDescription
console-text-wordwrap
true | false
false

Set "true" in order to activate word wrapping for the displayed text in console installation mode.

Since: 5.0.7

console-text-paging
true | false
false

Set "true" in order to activate paging for the displayed text in console installation mode.

Since: 5.0.7

 Example: 

Example of install.xml
<panels>
    <panel classname="PDFLicencePanel" id="panel.license">
      <configuration>
        <param name="console-text-paging" value="true" />
        <param name="console-text-wordwrap" value="false" />
      </configuration>
    </panel>
    ...
</panels> 

The two options work independently on each other. If there are both activated, word wrapping is done before calculating the page size for paging.

Labels/Messages

idDescription
LicencePanel.infoThe label text to be shown as panel label above the contents.

Resources

idDescription
PDFLicencePanel.<panel id>The name of the PDF file that contains the license agreement to show on the panel. If you don't specify the panel id then pane id is assumed to be licence (i.e. the resource id will be PDFLicencePanel.licence). 

Localization

The PDFLicencePanel is fully localized.

The title and button elements are translated from the built-in langpack files in the installer according to the chosen installer language.

In order to automatically choose translated license documents follow these steps:

  1. Specify the available languages the installer should support:

    install.xml
    <locale>
        <langpack iso3="eng"/>
        <langpack iso3="fra"/>
        <langpack iso3="deu"/>
    </locale>

    The above example adds translations for english, french and german language to the installer, which can be chosen in the initial language dialog (GUI mode) or automatically according to the system settings (console mode).

  2. For each translated license document, add a resource ending on '_' followed by the 3-letter ISO code of the according language.
    If you don't have at least one of the translated documents available, offer  the default resource which is the fallback for missing resources in the above format if that language is chosen:

    install.xml
    <resources>
        <res id="PDFLicencePanel.licence_eng" src="@{izpack.build.directory}/resources/License_eng.pdf" />
        <res id="PDFLicencePanel.licence_fra" src="@{izpack.build.directory}/resources/License_fra.pdf" />
        <res id="PDFLicencePanel.licence" src="@{izpack.build.directory}/License_eng.pdf"/>
    </resources>

    The above example adds an english and french translation of the license document, furthermore it uses the english translation as fallback for the german translation.

See Internationalizing resources for more information on automatic localization of resources in IzPack.

Maven Dependencies

This Panel depends on Apache PDF Box and Ice PDF. The dependencies must be available for the plugins and also included into the installer, enabling it to load the PDF in runtime when installing.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>	
	
	<parent>
		<groupId>some-group-id</groupId>
		<artifactId>some-parent-artifact-id</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>
	
	<artifactId>some-artifact-id</artifactId>

	<name>Sample Installer</name>
	<description>Installer for Sample</description>

	<packaging>jar</packaging>

	<dependencies>
		<!-- PDF Panel -->
      	<dependency>
        	<groupId>org.apache.pdfbox</groupId>
      	  	<artifactId>pdfbox</artifactId>
        	<version>1.8.10</version>
      	</dependency>
      	<dependency>
			<groupId>org.icepdf.os</groupId>
			<artifactId>icepdf-core</artifactId>
			<version>6.0.1</version>
	 	</dependency>
	 	<dependency>
			<groupId>org.icepdf.os</groupId>
			<artifactId>icepdf-viewer</artifactId>
			<version>6.0.1</version>
	  	</dependency>
	  	<!-- PDF Panel -->
	</dependencies>

	<build>
		<defaultGoal>package</defaultGoal>
		<resources>
			<resource>
				<directory>src/izpack</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<configuration>
					<transitive>true</transitive>
				</configuration>
				<executions>	
					<execution>
						<id>pdf</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<stripVersion>true</stripVersion>
							<includeScope>compile</includeScope>
							<outputDirectory>${stage.dir.fullpath}/deps</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.izpack</groupId>
				<artifactId>izpack-maven-plugin</artifactId>
				<version>${izpack-maven-plugin.version}</version>
				<dependencies>
					<dependency>
						<groupId>org.codehaus.izpack</groupId>
						<artifactId>izpack-compiler</artifactId>
						<version>${izpack.version}</version>
					</dependency>
					<!-- PDF Panel -->
      				<dependency>
        				<groupId>org.apache.pdfbox</groupId>
      				  	<artifactId>pdfbox</artifactId>
        					<version>1.8.10</version>
      				</dependency>
      					<dependency>
						<groupId>org.icepdf.os</groupId>
						<artifactId>icepdf-core</artifactId>
						<version>6.0.1</version>
	 				</dependency>
	 			 	<dependency>
						<groupId>org.icepdf.os</groupId>
		  				<artifactId>icepdf-viewer</artifactId>
		  				<version>6.0.1</version>
	  				</dependency>
	  				<!-- PDF Panel -->
				</dependencies>
				<configuration>
					<baseDir>${stage.dir.fullpath}</baseDir>
					<installFile>${stage.dir.fullpath}/install.xml</installFile>
					<mkdirs>true</mkdirs>
					<jarName>${project.build.finalName}-standard</jarName>
				</configuration>
				<executions>
					<execution>
						<id>standard-installer</id>
						<phase>package</phase>
						<goals>
							<goal>izpack</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>ice-maven-release</id>
			<name>Ice Maven Release Repository</name>
			<url>http://anonsvn.icesoft.org/repo/maven2/releases</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>ice-maven-release</id>
			<name>Ice Maven Release Repository</name>
			<url>http://anonsvn.icesoft.org/repo/maven2/releases</url>
		</pluginRepository>
	</pluginRepositories>
</project>

Limitations

The panel name & panel id are not taken into account for the panel label, the key is always taken as LicencePanel.info. The label LicencePanel.info is shared with LicencePanel & HTMLLicencePanel as well.