12.5. Using the pdfunit.config File

Typically PDFUnit does not need to be configured, but the file pdfunit.config gives you the chance to do so. The following sections show you how:

Locale of PDF Documents

Java needs a locale when working with date values and for the conversion of strings into lowercases too. PDFUnit reads the value of the locale from pdfunit.config. All the constants defined in java.util.Locale are allowed. The default value is en (English).

#############################################################################
# Locale of PDF documents, required by some tests.
#############################################################################
pdf.locale = en
#pdf.locale = de_DE
#pdf.locale = en_UK

You can write all values in lowercase or uppercase. PDFUnit also accepts underscore and hyphen as a delimiter between language and country.

If you delete the key pdf.locale from pdfunit.config by accident, then the default locale from the Java-runtime is taken (Locale.getDefault()).

Output Folder for Error Images

When a difference is detected while comparing rendered pages of two PDF documents, a diff image is created. It shows the referenced document on the left and differences to the actual test document on the right side. The differences are shown in red. The name of the test is placed above the image.

You can configure the output directory in the pdfunit.config. By default the diff images will be stored in the directory containing the test PDF. That might be useful for some projects. But when you want to have a fixed folder for all diff images, you can configure that behaviour by using the property diffimage.output.path.files:

#############################################################################
#
# The path can be absolute or relative. The base of a relative path depends 
# on the tool which starts the junit tests (Eclipse, ANT, etc.).
# The path must end with a slash. It must exist before you run the tests.
#
# If this property is not defined, the directory containing the PDF 
# files is used.
#
#############################################################################
diffimage.output.path.files = ./