Fix issue where pdfDocument is null

Happens when no file is loaded