Fix for PDF preview

In some cases, the preview shown for PDF documents was not updating properly, showing the wrong information. Oops. It is now fixed.