this needs a proper rewrite in order to be used with pdfminer3k