Changes to viewer to support progressive loading

Separates out some of the viewer changes from #2719.

These changes make it so that the viewer can load and draw pages separately, rather than requiring all pages before drawing.