end-to-end document legalisation