When viewing PDFs directly WebViewer is able to start rendering pages earlier when a PDF is linearized. Linearized PDF files are also known as "Fast Web View" which is often indicated in the document properties dialog of your favorite desktop PDF reader. You can use PDFTron SDK on your server to ensure PDF files are linearized.
Range requests allow the browser to request specific bytes from a URL. For WebViewer to efficiently download and start rendering documents quickly it's important that the server hosting the document file (for example PDF) supports these requests.
When serving files statically from a server this generally works without any configuration. However if you're serving the files in some other way you may need to use a library to handle the range requests for you.
The range request specification isn't very complicated so it's also possible for you to implement the handling yourself.
If you are doing file conversions of any type then you should always keep track of the original source file. For example, if you allow your customers to upload various file types (Office, images, text) and you convert them all to PDF, then you should still retain the original file, and maintain in your database links between the original and converted file. This ensures maximum flexibility and maintenance.
If viewing PDF or Office document directly, it's recommended that your server supports serving the larger worker files as pre-compressed brotli or gzip files. You can read more about this here.
WebViewer provides example implementations of annotation handlers for a few different languages which store all annotations as a single XFDF file on your server. This is one way to implement annotation handling, however if you have multiple users accessing the same document then timing issues can occur with one user overwriting the annotations of another.
One way to handle this to store the XFDF data for each annotation separately, for example as rows in a database. Then when WebViewer requests the annotation data for a document you can run a query to get all the annotations with that document id, append the data together and send it back to WebViewer.
This is similar to the approach that the realtime collaboration guide takes although that sample goes further and updates the data in real time. The important part to take away from it is the use of
importAnnotCommand to save and update the changes.