Inline images parsing in python 3 fix

Minor fixes in pdf.py to provide correct Inline images parsing in Python 3