How To Convert Documents To Xps
Document Toolkit supports XPS documents. In order to view other types of documents such as Word or Excel, document conversion is required. There are various document conversion options.
1) Microsoft XPS Document Writer
Both Windows Vista and Windows 7 come with a Microsoft XPS Document Writer
printer pre-installed. This printer driver doesn't actually print to paper, but generates an XPS document. Any document can be printed to XPS and consumed by Document Toolkit.
Please note that the Microsoft XPS Document Writer has its limitations; it doesn't generate links and the DefaultPackageReader, included in Document Toolkit, does not support the ZIP format of the generated XPS document. In order to load documents generated
by the Microsoft XPS Document Writer, please use the SharpZipPackageReader or the DotNetZipPackageReader available in the Document Toolkit Extensions project.
2) 3rd party converters
A variety of 3rd party converters exist, capable of converting documents to XPS. A list of 3rd party applications and converters is available at
The SampleBrowser project demonstrates on-the-fly document conversion using
. The conversion implementation is available in the ConvertToXpsHandler.cs in the DocumentServices project.
3) Office Save-As-Xps add-in
Office 2007 and 2010 include an add-in that allows you to save your Office document to XPS. The documents generated by this Office plugin are fully supported by Document Toolkit.
The Office Save-As-Xps addin can be automated, removing the need to manually save your documents to XPS. An implementation of such automation is available in the OfficeExport project of this Document Toolkit Extensions project. The project requires that Office2010
is installed on your machine.
Please note that the Save-As-Xps add-in is not suitable for use on the server. Office 2007 and 2010 are desktop products, for server side technology you could use Sharepoint 2010 Application Services (see next item).
4) Sharepoint 2010 Application Services
If you happen to use Sharepoint 2010, you can use
Word Automation Services
to convert your word document on the server. Word Automation Services is a new service application in SharePoint Server 2010. Word Automation Services provides unattended, server-side conversion of documents into the XPS format.
5) Optimize XPS documents
A lot of effort has been put into making Document Toolkit a compliant XPS consumer. However, due to various reasons, among others the limitations of the Silverlight runtime, not all XPS documents will be completely rendered. The XPS specification for instance
allows for images of type TIFF and Windows Media Photo. Both image types are not supported in Silverlight and Document Toolkit will simply ignore these images.
In order to avoid image rendering issues in Document Toolkit, the project XpsConvert has been introduced. XpsConvert takes any XPS document and converts all unsupported images to images of type PNG. The XpsConvert project is a .NET 4 library, which uses the
Open Packaging API