# Document Structure

If you've seen a .kdf file before, you may have been mislead into thinking it was a single file. In actuality, a KDF file is an archive—a collection of many smaller files bundled into one using the Tar utility. Each smaller file has a specific responsibility, and contains data that describes one component of the overall document. We will explore the purpose of these smaller files below.

# Archive Layout

A KDF document has the following layout of files and directories. Each file/folder contains a link to the section of the specification that defines it.

File/Folder Purpose
content.json Contains the content and structure of a document.
colours.json Defines the document level colour palette.
dictionary.json An optional file that lists words to include in the document level dictionary.
metadata.json Stores document metadata, such as title, authors, etc.
styles.json Describes how pages and other elements should look.
resources/ A directory containing images, fonts, and other static content.
thumbnail.png An optional thumbnail image to display in the file system.

TIP

You can inspect the layout of a KDF file by changing the file extension from .kdf to .tar.gz, and then extracting the contents of the archive to your file system. If you're a Windows user, you may require a third party tool such as 7zip or WinRAR to extract a .tar.gz file.

# Compression

KDF documents should be compressed to reduce their overall footprint. This has a number of benefits, such as taking less space on the user's file system, and improving transfer speeds across networks. The compression algorithm of choice for KDF is Gzip.