support pre-encode document