Export (0) Print
Expand All

XpsRollup

XpsRollup is a sample program that combines multiple XPS documents into a single document and renames the resource parts to prevent part name conflicts. This sample provides an excellent illustration for how to identify and navigate the component parts of an XPS document.

This topic contains the following sections:

Description

The XpsRollup sample program reads one or more XPS documents and uses the IXpsOMPackageWriter interface to write the merged document back to a file.

The filenames of an XPS document are read from the command line, and the XPS documents are read into an IXpsOMPackage interface through the IXpsOMObjectFactory::CreatePackageFromFile method. The contents and resources of each document are found, read, then renamed and written to the output package.

The program closes the IXpsOMPackageWriter interface, which writes the merged documents to the output package as a single, merged XPS document.

Important   This sample doesn't merge IXpsOMStoryFragmentsResource parts. If one of the XPS documents contains a IXpsOMStoryFragmentsResource part, you'll get an incorrect output.

Requirements

ProductVersion
Microsoft WindowsWindows 7
Windows SDKWindows 7 Platform Software Development Kit (SDK)
Microsoft Visual StudioVisual Studio 2008 or later

 

Downloading the Sample

LocationPath/URL
Windows SDK\Program Files\Microsoft SDKs\Windows\v7.0\samples\xps\XpsRollup
Code Galleryhttp://go.microsoft.com/fwlink/p/?linkid=152528

 

Building the Sample

To build the sample using Visual Studio:

  1. Open Windows Explorer and navigate to the directory that contains the sample code files.

  2. Double-click the icon for the .sln (solution) file; this will open the file in Visual Studio.

    Note  The solution file in this sample is compatible with Visual Studio 2008 and later versions of Visual Studio.

  3. In the Build menu, select Build Solution.

The application will be built in the default \Debug or \Release directory.

Running the Sample

To run the sample after it has been built:

  1. Open a Command Prompt window and navigate to the directory that contains the new executable file.
  2. At the command prompt, type the command as described in the Additional Information section.

Additional Information

As a console application, XpsRollup.exe must be run in the Command Prompt window. The command is formatted as follows:

XpsRollup output_filename input_filename [input_filename ...]

In this command,

output_filename is the name of the new XPS document that will contain the pages and required resources of all the input files.

input_filename is the name of an XPS document to be read and appended to the created document. The command line can contain one or more input_filename parameters, each separated by a space. Filenames that contain spaces must be enclosed within double quotes.

Each input file is opened and copied to the output file in the order specified at the command prompt.

To see all of the XPS programming sample programs, see the XPS Programming Samples on MSDN Code Gallery.

Related topics

IOpcPartUri
IXpsOMColorProfileResource
IXpsOMColorProfileResourceCollection
IXpsOMDocumentCollection
IXpsOMDocumentSequence
IXpsOMFontResource
IXpsOMFontResourceCollection
IXpsOMImageResource
IXpsOMImageResourceCollection
IXpsOMObjectFactory
IXpsOMPackage
IXpsOMPackageWriter
IXpsOMPage
IXpsOMPageReference
IXpsOMPageReferenceCollection
IXpsOMPartResources
IXpsOMPrintTicketResource
IXpsOMRemoteDictionaryResource
IXpsOMResource
IXpsOMStoryFragmentsResource
IXpsOMRemoteDictionaryResourceCollection
XPS_SIZE
Navigate the XPS OM
Common XPS Document Programming Tasks

 

 

Community Additions

ADD
Show:
© 2014 Microsoft