Fix ClassCastException on PDFAsImage