Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Visual Basic 2010 : Manipulating Documents and Media - Viewing XPS Documents

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/6/2011 11:39:40 AM
Starting from Windows Vista, Microsoft introduced a new file format known as XPS that is a portable file format for documents and is useful because you can share documents without the of having installed the application that generated that kind of document because you simply need a viewer. WPF offers full support for XPS documents, also offering a DocumentViewer control that enables developers to embed XPS viewing functionalities in their applications. Support for XPS documents is provided by the ReachFramework.dll assembly (so you need to add a reference) that exposes the System.Windows.Xps.Packaging namespace. For code, you simply drag the DocumentViewer control from the toolbox onto the Window surface so that the generated XAML looks like the following:
<DocumentViewer Name="DocumentViewer1" />

At design time you can notice how such control offers a number of buttons for adjusting the document layout, for zooming and printing. XPS documents are fixed documents differently from flow documents, so you need to create an instance of the XpsDocument class and get a fixed sequence of sheets to be assigned to the Document property of the viewer, as demonstrated in the following code snippet that enables loading and presenting an XPS document:

Dim documentName As String = "C:\MyDoc.xps"
Dim xpsDoc As XpsDocument

xpsDoc = New XpsDocument(documentName, IO.FileAccess.ReadWrite)
DocumentViewer1.Document = xpsDoc.GetFixedDocumentSequence

Figure 1 shows a sample XPS document opened in the DocumentViewer control.

Figure 1. Viewing XPS documents through the DocumentViewer control.

So with a few steps you can embed XPS functionalities in your applications.

Other -----------------
- Visual Basic 2010 : Manipulating Documents and Media - Manipulating Documents
- Visual Basic 2010 : Manipulating Documents and Media - Viewing Images & Playing Media
- Automating the Windows 7 Installation : Deploying Unattended Installations (part 4) - Microsoft Assessment and Planning Toolkit
- Automating the Windows 7 Installation : Deploying Unattended Installations (part 3) - Installing the WDS Server Components
- Automating the Windows 7 Installation : Deploying Unattended Installations (part 2) - Using Windows System Image Manager to Create Answer Files
- Automating the Windows 7 Installation : Deploying Unattended Installations (part 1)
- Microsoft Visio 2010 : Understanding Organization Charts & Building an Organization Chart by Hand
- Microsoft Visio 2010 : Creating Swimlane Diagrams
- Microsoft Excel 2010 : Editing Chart Data
- Microsoft Excel 2010 : Changing the Chart Background & Enhancing a Chart
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server