XPS to PDF Online

XPS (XML Paper Specification) and PDF (Portable Document Format) are both widely used formats for sharing and archiving documents. XPS was developed by Microsoft as an alternative to PDF, offering similar capabilities for preserving the visual appearance and layout of documents. However, PDF has gained more widespread popularity over time due to its compatibility across different platforms and devices. Sometimes, you may need to convert XPS to PDF documents for different purposes. Accordingly, this blog post covers how to convert XPS to PDF Online for Free or in C# .NET, or Java.

Free XPS to PDF Converter Online

While XPS files can be opened on Windows computers using the built-in XPS Viewer, compatibility issues arise when attempting to open XPS files on other operating systems or devices. This is where the need for online conversion arises. Converting XPS to PDF ensures that your documents can be easily viewed, shared, and printed across various platforms without any formatting discrepancies.

Accordingly, this free XPS to PDF converter has revolutionized the conversion as you do not need to install any additional software to perform the conversion.

  1. First of all, browse online visio converter with an internet browser.
  2. Drop the file in the rectangular pane and upload the source file.
  3. The input file will finish upload and Convert button will be enabled.
  4. Initiate the conversion and start rendering XPS to PDF.
  5. Download the output PDF document or copy the link to access it online.

PS: The online link to download or share the output file will be enabled after 24 hours as your data is not stored on the server.

Benefits of Online Conversion for XPS to PDF

Accessibility: This online converter is accessible from any device with an internet connection, eliminating the need for software installation.

Time and Effort Savings: This online converter streamlines the conversion process, saving you time and effort compared to traditional software.

Platform Compatibility: The resulting PDF files are compatible with a wide range of devices and operating systems.

User-Friendly Interface: This online converter has feature intuitive interface that make the conversion process straightforward even for users with limited technical expertise.

Convert XPS to PDF in C#

You can easily convert XPS to PDF in C# by following the steps below:

  • Configure Conholdate.Total for .NET in your project.
  • Initiate streams and load the input XPS file.
  • Initialize PdfSaveOptions class object.
  • Create rendering device for PDF format.

The following code sample explains how to convert XPS to PDF in C#:

// Initialize PDF output stream
using (System.IO.Stream pdfStream = System.IO.File.Open(dataDir + "XPStoPDF.pdf", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write))
// Initialize XPS input stream
//using (System.IO.Stream xpsStream = System.IO.File.Open(dataDir + "input.xps", System.IO.FileMode.Open))
using (System.IO.Stream xpsStream = System.IO.File.Open(dataDir + "sample.xps", System.IO.FileMode.Open))
{
// Load XPS document form the stream
Aspose.Page.XPS.XpsDocument document = new Aspose.Page.XPS.XpsDocument(xpsStream, new Aspose.Page.XPS.XpsLoadOptions());
// or load XPS document directly from file. No xpsStream is needed then.
// XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions());
// Initialize options object with necessary parameters.
Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions options = new Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions()
{
JpegQualityLevel = 100,
ImageCompression = Aspose.Page.XPS.Presentation.Pdf.PdfImageCompression.Jpeg,
TextCompression = Aspose.Page.XPS.Presentation.Pdf.PdfTextCompression.Flate,
};
// Create rendering device for PDF format
Aspose.Page.XPS.Presentation.Pdf.PdfDevice device = new Aspose.Page.XPS.Presentation.Pdf.PdfDevice(pdfStream);
document.Save(device, options);
}
view raw XPStoPDFfile.cs hosted with ❤ by GitHub

Convert XPS Diagrams to PDF in Java

The following steps elaborate how to convert XPS to PDF in Java:

  • Install Conholdate.Total for Java in your application.
  • initialize PDF output stream using FileOutputStream.
  • Initialize PdfSaveOptions with necessary parameters.

The sample code below demonstrates how to convert XPS to PDF in Java:

// Load XPS document
XpsDocument document = new XpsDocument("input.xps");
// Initialize options object with necessary parameters.
com.aspose.xps.rendering.PdfSaveOptions options = new com.aspose.xps.rendering.PdfSaveOptions();
options.setJpegQualityLevel(100);
options.setImageCompression(com.aspose.xps.rendering.PdfImageCompression.Jpeg);
options.setTextCompression(com.aspose.xps.rendering.PdfTextCompression.Flate);
options.setPageNumbers(new int[] { 1, 2, 6 });
// Save XPS document as PDF
document.saveAsPdf("XPStoPDF.pdf", options);

Free Evaluation License

You may request a free temporary license to test the APIs in full capacity.

Summing Up

Converting XPS files to PDF format has never been easier, thanks to this online conversion. Whether you’re an individual looking to share documents with friends or a business professional needing to ensure cross-platform compatibility, this converter offers a convenient solution to your conversion needs. Moreover, it also covers integrating this feature into your applications using C# or Java. In case of any queries, please write to us at the forum.

See Also