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.
Requirements
| Product | Version |
| Microsoft Windows | Windows 7 |
| Windows SDK | Windows 7 Platform Software Development Kit (SDK) |
| Microsoft Visual Studio | Visual Studio 2008 or later |
Downloading the Sample
Building the Sample
To build the sample using Visual Studio:
-
Open Windows Explorer and navigate to the directory that contains the sample code files.
-
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.
-
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:
- Open a Command Prompt window and navigate to the directory that contains the new executable file.
- 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.
See Also
- 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
- Using the XPS Object Model
Send comments about this topic to Microsoft
Build date: 11/17/2009