public class XpsConverter extends Object implements IPlugin
Represents XpsConverter plugin.
The example demonstrates how to convert XPS document to PDF document.// create XpsConverter XpsConverter converter = new XpsConverter(); // create XpsConverterToPdfOptions object to set output data type as file XpsConverterToPdfOptions opt = new XpsConverterToPdfOptions(); // add input file path opt.addDataSource(new FileDataSource(inputPath)); // set output file path opt.addSaveDataSource(new FileDataSource(outputPath)); // launch conversion process ResultContainer results = converter.process(opt);
The example demonstrates how to convert XPS document to image with file output.// create XpsConverter XpsConverter converter = new XpsConverter(); // create XpsConverterToImageOptions with JPEG target image format. The default image format for resulting image is PNG. // Also we can set a size of the resulting image, a resolution, a smoothing mode and JPEG quality level for JPEG resulting image format. XpsConverterToImageOptions opt = new XpsConverterToImageOptions(ImageFormat.Jpeg); // add input file path opt.addDataSource(new FileDataSource(inputPath)); // if input XPS file is multipaged the results will be a set of image files with name: ["outputPath" without extension][pageNumber started from 0].[extension from "outputPath"] opt.addSaveDataSource(new FileDataSource(outputPath)); // launch conversion process converter.process(opt);
The example demonstrates how to convert XPS document to image with bytes arrays output.In the bytes arrays output datasource (byte [][]) one bytes array contains an image of one page. Thus, for one-paged documents the result will contain [1][] array, for multi-paged documents the result will contain [number of pages in input XPS document][] array. // create XpsConverter XpsConverter converter = new XpsConverter(); // create XpsConverterToImageOptions with JPEG target image format. The default image format for resulting image is PNG. // Also we can set a size of the resulting image, a resolution, a smoothing mode and JPEG quality level for JPEG resulting image format. XpsConverterToImageOptions opt = new XpsConverterToImageOptions(ImageFormat.Jpeg); // add input file path opt.addDataSource(new FileDataSource(inputPath)); // if input XPS file is multipaged the results will be a set of image files with name: ["outputPath" without extension][pageNumber started from 1].[extension from "outputPath"] opt.addSaveDataSource(new ByteArrayDataSource()); // launch conversion process converter.process(opt); // get resulting bytes arrays byte[][] imagesBytes = (byte [][]) ((ByteArrayResult)results.ResultCollection[0]).Data;
| Constructor and Description |
|---|
XpsConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Implementation of IDisposable.
|
ResultContainer |
process(IPluginOptions options)
Starts the XpsConverter processing with the specified parameters.
|
public final ResultContainer process(IPluginOptions options) throws Exception
Starts the XpsConverter processing with the specified parameters.
public final void dispose()
Implementation of IDisposable.
Copyright © 2025 Aspose. All Rights Reserved.