Unlike the usual service pack releases, ClientUI 5 SP1 wasn’t set to deliver only bug fixes and minor enhancements, it also ships new major features such as full LightSwitch support, blazing-fast document streaming in XPS viewer, and an advanced event aggregator. I have discussed about LightSwitch support in my previous post, click here to check it out.
In this post, I will share some of the new features that we’ve added to our flagship ClientUI suite. One of the most significant new features is the document streaming capability in the XPS Document Viewer. Just a quick recap, XPS Document Viewer is a UI control that lets you display any XPS compatible documents in a Silverlight or WPF application – using one codebase. It was first introduced in ClientUI 5 released months ago, packed with beautiful user interface and numerous advanced features. You can get an overview about XPS Document Viewer here, and the technical details here.
Introducing Document Streaming
As savvy computer users, we all have heard the ‘streaming’ term everywhere, from the video streaming in Youtube to radio streaming in iTunes. At a glance, streaming is a data transfer process that allows a stream of packets to be interpreted and rendered in real-time, without requiring the whole data to be prior downloaded. The basic idea is to allow large content to be served in the shortest time possible.
The same metaphor applies to other type of medias as well such as document. In the recently released service pack 1, we’ve added a powerful document streaming capability to the XPS Document Viewer. The main objective of the document streaming is obvious; it enables very large XPS document to be rendered immediately in the client-side, without requiring the whole document to be prior downloaded.
The following illustration shows the comparison between the document download and document streaming.
The streaming capability in our XPS Viewer (runs on both Silverlight and WPF!) is extremely useful particularly in business application scenarios. Supposed you’re building a document library application that hosts a 60MB technical documentation, you definitely don’t want your users to wait for minutes just to view a topic. So with document streaming, the waiting time is eliminated. The document is displayed almost immediately with all essential features such as navigation and bookmark to work consistently.
Enabling Document Streaming
To make document streaming possible and seamless to the client, we provided a built-in document streaming handler that sits in the ASP.NET web server. A new server library called Intersoft.XPSDocumentViewer.Server.dll is shipped in the service pack 1 release which you can locate in the Server folder of the ClientUI installation.
Enabling the streaming feature in XPSDocumentViewer is pretty straightforward. Since the streaming handler sits down in the web server, you need to configure the web project before enabling it in the client side. Here’s how.
On the ASP.NET web project:
- The first step is to add the Intersoft.XPSDocumentViewer.Server to the web project. The assembly can be located in [Program Files]\Intersoft Solutions\ClientUI 5\Server. Once added, your project looks like the following shot.
- Add the HTTP handler registration for document streaming handler in the web.config.
<httpHandlers> <add verb="*" path="XPSDocumentStreamHandler.ashx" type="Intersoft.XPSDocumentViewer.Server.XPSDocumentStreamHandler, Intersoft.XPSDocumentViewer.Server"/> </httpHandlers>
That’s all for the web project configuration.
On the Silverlight project: You only need to set two properties to leverage the streaming capability. Simply set the EnableDocumentStreaming property to true and then specify the URL of the streaming handler in the DocumentStreamingHandler property. It’s that simple!
Note that all existing features are supported, as well as advanced features like searching and bookmark navigation.
Here’s an example of the XPSDocumentViewer declaration in XAML.
<Intersoft:XPSDocumentViewer Source="Documents/XPS_1_0.xps" EnableDocumentStreaming="True" DocumentStreamingHandler="http://localhost:5153/XPSDocumentStreamHandler.ashx"/>
In this example, I’m testing the document streaming capability with a 8MB XPS document. Check out the sample online here, notice that the XPS viewer renders the requested pages instantly. You can try to scroll down quickly, or jump to a specific page to see the streaming in action.
Once you launched the sample in the browser, you should see the XPS viewer interface such as shown below.
Click here to download the sample and explore the feature for yourself. Finally, make sure you already have ClientUI 5 service pack 1 installed to take advantage this powerful streaming capability. If you haven’t, please grab your trial copy here.