refactor(doc): use ffi binding in picdocument