Init document environment