Create XPS documents from scratch

C++ API solution to create and change XPS files.

 

Aspose.Page for C++ API solution lets you manipulate XPS files and other Page Description Language format files. The rich functionality allows adding different shapes to documents, merging a few files into a single one, or converting them to a more suitable format. In case you only start working with this format, here is described how to create new XPS files and modify (add glyphs to) the already existing ones. The code snippet is added for better understandability.

To create a new XPS file, we need:

  • Aspose.Page for C++ API which is a feature-rich, powerful and easy to use document manipulation and conversion API for C++ platform.

  • You can download its latest version directly, just open NuGet package manager, and search for Aspose.Page.Cpp and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command

    PM> Install-Package Aspose.Page.Cpp

Create an XPS file with C++

  1. Create a new XPS document using the MakeObject function, which returns an object of the XpsDocument Class
  2. Add a set of glyphs to the document using the AddGlyphs() Method of the XPS document object.
  3. Set the fill color of the text using the set_Fill Method, passing in a solid color brush created by the CreateSolidColorBrush Method of the XPS document object.
  4. Save the result XPS document to a file named output.xps in the directory specified by the dir variable.
Create XPS files



FAQ

1. How can I edit an XPS file?

To modify XPS files with this API Solution first set the path to the file and then use the entities of the XpsDocument Class to implement the changes.

2. How to create an XPS file?

To make a new XPS file using Aspose.Page you need to set the path to the document and then use the XpsDocument constructor of the XpsDocument Class.

3. How do I convert XPS to DOCX?

To get DOCX file from an XPS one, use our free cross-platform Converter

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.