Added some console logs to see document length. Actually reading the file works great, with the exception of reading too many pixels