Ported DocumentViewer to TypeScript