1. A method comprising: selecting document layer data for encoding; encoding the selected document layer data in a machine-readable format; determining the amount of space available on each page to print the encoding corresponding to layer data associated with that page of the document; and printing the contents of each page of the document with its associated machine-readable encoding, if space is available on the page to print the machine-readable encoding; or printing the machine-readable encoding separately, if space available on the page is not sufficient to print the machine-readable encoding.