generating the document