 				layoutReady.promise.then () ->
 					# console.log 'layoutReady was resolved'
 
-				# TODO can we combine this with scope.parentSize, need to finalize boxes
-				updateContainer = () ->
-					scope.containerSize = [
-						element.innerWidth()
-						element.innerHeight()
-						element.offset().top
-					]
+				renderVisiblePages = () ->
+					visiblePages = getVisiblePages()
+					pages = getExtraPages visiblePages
+					scope.document.renderPages(pages)
 
 				getVisiblePages = () ->
 					top = element.offset().top

			# find first visible page
			visible = $scope.pages.some (page, i) ->
				[topPageIdx, topPage] = [i, page] if page.visible
			if visible
				# console.log 'found it', topPageIdx
			else
				# console.log 'CANNOT FIND TOP PAGE'
				return

			# console.log 'top page is', topPage.pageNum, topPage.elemTop, topPage.elemBottom, topPage
			top = topPage.elemTop
			bottom = topPage.elemBottom
			viewportTop = 0
			viewportHeight = $element.height()
			topVisible = (top >= viewportTop && top < viewportTop + viewportHeight)
			someContentVisible = (top < viewportTop && bottom > viewportTop)
			# console.log 'in PdfListView', top, topVisible, someContentVisible, viewportTop
			if topVisible

						pageTop = pageElement.offset().top
						pageBottom = pageTop + pageElement.innerHeight()
						return pageTop < bottom and pageBottom > top
					visiblePages = []
					for page in scope.pages
						page.visible = visible = isVisible(page.element)
						visiblePages.push page if visible
					return visiblePages

				getExtraPages = (visiblePages) ->
					extra = []
