Incorrect endPos in PDFDOC creation