Cross-package operations within XPS Package

Manipulate pages, colors and glyphs within XPS Package via C++

 

Aspose.Page API for C++ offers a separate library for working with XPS files, allowing you to treat them as a distinct format. This library boasts a variety of useful features, including merging XPS documents, converting them to other formats, and manipulating graphics within them.

One key aspect of XPS files is their ability to contain multiple files within a single document. As a result, the Aspose.Page XPS library provides functionalities for managing these internal files and their pages. These operations, known as "cross-package operations," involve manipulating content across different XPS documents.

This section will delve into specific examples of cross-package operations, such as managing pages within a single XPS document and adding text (glyphs) with specific colors.

But to try the functionality you first need to get the solution:

  • Open the NuGet package manager, and search for Aspose.Page and install. You may also use the following command from the Package Manager Console.

Steps to manipulate pages within XPS Package C++.

  1. Set the path to the documents directory.
  2. Create an XPS file using the XpsDocument Class .
  3. To insert an active page from one document to the beginning of another document use the InsertPage() Method.
  4. To insert an active page from one document to the end of another document use the AddPage() Method.
  5. To remove an empty page use the RemovePage() Method.
  6. To remove a page from one document to another document use the InsertPage() and SelectActivePage() Methods.
  7. Save the changed XPS documents using the XPsDocument.Save Method.
Manipulate Pages

Steps to add a glyph clone within XPS Package C++.

  1. Set the path to the documents directory.
  2. Open a stream of the XPS file.
  3. Create an XPS file using the XpsDocument Class.
  4. Add glyphs to the document using the AddGlyphs() Method.
  5. Create the second XPS file using the XpsDocument Class.
  6. To clone the glyph from the first file to the second file, use the Add() and Clone() Methods.
  7. Save both XPS documents by means of the XPsDocument.Save() Method.
Add Glyph Clone And Change Color

Steps to add an image-filled Glyph C++.

  1. Set the path to the documents directory.
  2. Open a stream of the XPS file.
  3. Create an XPS file using the XpsDocument Class.
  4. Add glyphs to the document using the AddGlyphs() Method.
  5. To fill the glyphs with an image brush use the CreateImageBrush() Method.
  6. Create the second XPS file using the XpsDocument Class.
  7. Add glyphs with the font from the first document to the second document using the AddGlyphs() Method.
  8. Create an image brush from the fill of the first document and fill glyphs in the second document using the CreateImageBrush() Method.
  9. Save both XPS documents by means of the XPsDocument.Save() Method.
Add Image Filled Glyph And Foreign Image

XPS What is XPS File Format

XPS format is similar to PDF format. Both are page description language (PDL) formats. EPS is based on HTML and not on PostScript language. The .eps file is capable to contain a markup of the document's structure along with the information on how the document would look like. There are also added instructions on how to print and render the document. The feature of the format is that it fixes the document's description which means that it will look the same no matter who and from what operational system opens it.