Convert XPS or OXPS Files to PDF Format using C++

XPS and OXPS documents define the layout, appearance, and printing information. These documents are similar to PDF files. Due to the high popularity of the PDF format, you might find yourself in situations where you need to convert XPS and OXPS documents to PDF format. To that end, this article will teach you how to convert XPS and OXPS documents to PDF format using C++.

C++ API for Converting XPS and OXPS Documents to PDF Format

Aspose.Page for C++ is a C++ library for rendering and manipulating XPS and PostScript files. It allows you to create, read and update XPS documents. Furthermore, the API supports converting XPS and OXPS documents to PDF format. You can either install the API through NuGet or download it directly from the downloads section.

PM> Install-Package Aspose.Page.Cpp

Convert XPS/OXPS Documents to PDF Format

The following are the steps to convert XPS and OXPS documents to PDF format.

The following sample code shows how to convert XPS/OXPS documents to PDF format using C++.

Image of the output PDF file generated by the sample code

Image of the output PDF file generated by the sample code

Convert Selected Pages of XPS/OXPS Documents to PDF Format

While converting XPS and OXPS files to PDF format, you can also specify the pages you want to convert. The output PDF file will contain only the pages you select. To achieve this, please follow the steps given below.

The following sample code demonstrates how to convert selected pages of XPS and OXPS documents to PDF format using C++.

Image of the output PDF file generated by the sample code

Image of the output PDF file generated by the sample code

Get a Free Licence

You can try the API without evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to convert XPS and OXPS documents to PDF format using C++. Additionally, you have seen how to convert selected pages of the XPS/OXPS documents to PDF format using Aspose.Page for C++ API. The API provides many additional features for working with XPS documents that you can explore in detail by visiting the official documentation. In case of any questions, please feel free to reach us on our free support forum.

See Also