==============
Document files
==============

.. versionadded:: 4.0

.. note::

   Previous to version 4.0, there was no distinction between a document file
   and a document version. In addition, each document version had a 1 to 1
   relationship to a document file. That relationship extended to the pages
   and their layout.


Mayan EDMS support creating multiple files in relation to a single document.
In essence, the Document is a file container.

When a new file is uploaded, by default a new document version is created.
The new version page layout will match the page layout of the uploaded file.
The page layout of the document version can be updated without affecting
the page layout of the uploaded document files.

If more than one file was uploaded for a given document, the pages all of the
document files are available to be mapped to any number of document versions
that users may which to created. This allows reconfiguring or remapping the
pages of the uploaded files in a non-destructive way.

The uploaded files are never modified, using the remapping function,
only the document version (which acts a the visual representation of the
document) is modified.

The document files are the source material, providing a collection of pages,
from which users can pick and choose to assign to the document versions.

Document files may be deleted in order. Deleting a document file will cause
all document version pages that are mapped to it to also be deleted.

Only the interactive document sources (``Web`` and ``Staging folders``)
are available to upload new document files.

There is no limit to the number of files a document can have.

By default, the last file will be shown when working with the document
but any of the files can be inspected and viewed.


Transformations
===============

If is possible to apply visual transformations to document
file pages. Transformations applied to a document file page will be reflected
on any document version page that maps to it. Subsequent document version
page transformation can also be applied. Since document file pages are the
source material for document version pages, any change in the transformations
of the document file page will reflect on the document version page also.
However transformations applied a document version page will not be
reflected on the source document version file.


Downloads
=========

When a document file is uploaded the actual filename of the file is retained
and used as the download filename including its original extensions if any.
When a document file is downloaded, the exact file that was uploaded will be
obtained.
