Code vector graphics shapes of XPS files

C++ API solution to work with vector graphics of XPS files

 

XPS, like other Page Description Languages, allows working with vector graphics. This C++ API solution includes the manipulation of vector graphics of XPS files. It offers a wide range of functionality, part of which is depicted in the code snippet here. There are just a few examples of how to add oval and rectangle shapes to files. Additionally, you will learn to manage the colors of these shapes. By following this method, you will be able to create any geometric shape you require.

To work with vector graphics shapes of XPS, 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

Steps to add a rectangle with C++.

  1. First, set the path to the directory where the document will be saved.
  2. Create an XPS file by instantiating the XpsDocument Class .
  3. Use the methods of the XpsPath Class to create a rectangle.
  4. Finally, save the modified XPS document by calling the XPsDocument.Save Method.
Add a rectangle

Add an ellipse with C++.

To add an ellipse or other figure to an XPS file you will need to take similar steps and use the same entities as for adding a rectangle.

Add an ellipse

XPS What is XPS File Format

XPS (XML Paper Specification) is Microsoft’s open‑source alternative to PDF. It uses XML/HTML markup to describe page layout, fonts, and images, ensuring consistent rendering across Windows platforms and other operating systems.