Add images to XPS

Dynamic API solution for C++ that enhances your XPS files by adding stunning images in an easy way. Supercharge your C++ applications and elevate the content of XPS files!

 

Aspose.Page for C++ API solution lets you manipulate XPS files along with other Page Description Language format files. Among other features the Solution allows you to easily create and read XPS documents and add an image to them. You can accomplish this by creating a Matrix and an ImageBrush to add the image to the XPS file. Here’s an example of how to do this. For complete examples and data files, please go to our Github project . Elevate your XPS documents with this API solution! Seamlessly integrate image insertion capabilities, allowing you to effortlessly enhance your XPS files with visuals. No matter if you’re crafting engaging reports, designing presentations, or creating captivating documents, our API simplifies the process, ensuring precision and efficiency. Bring your content creation capabilities to a new level. Discover the magic of easy image integration with our C++ API solution by getting a free trial or just buy it right away!

In order to add a picture to an XPS file you need to have:

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

  • 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 images to an XPS file.

  1. Create a new XPS document using the XpsDocument Class.
  2. Create an XpsPath object with the necessary Path Geometry defined. Calling the AddPath() Method for this
  3. If needed to create a matrix, which is used to position the image, it is set as the RenderTransform Property of the path.
  4. Create an ImageBrush to fill the path with the image. The CreateImageBrush() Method is used to create the brush, and it takes in the path of the image file, the source rectangle, and the destination rectangle.
  5. Save the modified XPS document by calling the Save() Method of the XpsDocument Class and passing in the path to save the file.
Add images to XPS

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.