View document in web viewer without loading of whole document

Blog category: ImagingWeb

December 1, 2023

Let's suppose that PDF document of 10000 pages with size 1 GB is stored on WebServer1. We want to view only the last page of PDF document. There is no application for viewing PDF documents available on WebServer1, but the application for viewing PDF documents is available on WebServer2.

The simplest solution is to copy that PDF file from WebServer1 to WebServer2 and view the last page of document on WebServer2. However we will require to copy the entire file to view only the one page from 10000 pages. Also the copying of file between servers may take significant time.

The ideal solution would nearly be to copy only the latest page data of PDF document from WebServer1 to WebServer2 and view the latest page on WebServer2.

A web server, which works under HTTP 1.0 protocol allows to download the entire file only, so it seems our task has no solution. But a web server, which works under HTTP 1.1 allows to download a part of file using HTTP range-request and this could be the appropriate solution.

Beginning from version 12.3 VintaSoft web document viewer can work with a document, which is located on another web server using HTTP range-requests. The web document viewer inquires from web server, which stores the file, only the data necessary for viewing of displayed page.

Here is JavaScript code allowing to open in web document viewer a PDF document, which is specified by URL:
  // create web document viewer
  var documentViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(documentViewerSettings);

  // open PDF document from URL