Only handle scroll events when PDF.pdfDocument is defined (issue 4642)

Attempted workaround to fix #4642. This should work, and it's a very easy solution, but I'm not completely convinced that this is the best way to handle the issue.

@dferer Does this fix the issue?