PsConverter

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.page.plugins.IPlugin

public class PsConverter implements IPlugin

表示 PsConverter 插件。

此示例演示如何将 PS/EPS 文件转换为 PDF 文档。

// 创建 PsConverter PsConverter converter = new PsConverter(); // 创建 PsConverterToPdfOptions 对象以将输出数据类型设置为文件 PsConverterToPdfOptions opt = new PsConverterToPdfOptions(); // 添加输入文件路径 opt.addDataSource(new FileDataSource(inputPath)); // 设置输出文件路径 opt.addSaveDataSource(new FileDataSource(outputPath)); // 启动转换过程 ResultContainer results = converter.process(opt);

此示例演示如何将 PS/EPS 文件转换为图像并输出为文件。

// 创建 PsConverter PsConverter converter = new PsConverter(); // 创建 PsConverterToImageOptions,目标图像格式为 JPEG。生成图像的默认格式为 PNG。 // 同时我们可以设置生成图像的尺寸、分辨率、平滑模式以及 JPEG 结果图像格式的质量等级。 PsConverterToImageOptions opt = new PsConverterToImageOptions(ImageFormat.Jpeg); // 添加输入文件路径 opt.addDataSource(new FileDataSource(inputPath)); // 如果输入的 PS 文件是多页的,结果将是一组图像文件,命名方式为:["outputPath" without extension][pageNumber started from 0].[extension from "outputPath"] opt.addSaveDataSource(new FileDataSource(outputPath)); // 启动转换过程 converter.process(opt);

此示例演示如何将 PS/EPS 文件转换为图像并以字节数组输出。

在字节数组输出数据源 (byte[][]) 中,每个字节数组包含一页的图像。因此,对于单页文档,结果将包含 [1][] 数组;对于多页文档,结果将包含 [输入 PS 文档的页数][] 数组。 // 创建 PsConverter PsConverter converter = new PsConverter(); // 创建 PsConverterToImageOptions,目标图像格式为 JPEG。生成图像的默认格式为 PNG。 // 同时我们可以设置生成图像的尺寸、分辨率、平滑模式以及 JPEG 结果图像格式的质量等级。 PsConverterToImageOptions opt = new PsConverterToImageOptions(ImageFormat.Jpeg); // 添加输入文件路径 opt.addDataSource(new FileDataSource(inputPath)); // 如果输入的 PS 文件是多页的,结果将是一组图像文件,命名方式为:["outputPath" without extension][pageNumber started from 0].[extension from "outputPath"] opt.addSaveDataSource(new ByteArrayDataSource()); // 启动转换过程 converter.process(opt); // 获取生成的字节数组 byte[][] imagesBytes = (byte [][]) ((ByteArrayResult)results.ResultCollection[0]).Data;

构造函数

构造函数描述
PsConverter()

方法

方法描述
dispose()IDisposable 的实现。
equals(Object arg0)
getClass()
hashCode()
notify()
notifyAll()
process(IPluginOptions options)使用指定的参数启动 PsConverter 处理。
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

PsConverter()

public PsConverter()

dispose()

public final void dispose()

IDisposable 的实现。

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

参数类型描述
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

process(IPluginOptions options)

public final ResultContainer process(IPluginOptions options)

使用指定的参数启动 PsConverter 处理。

Parameters:

参数类型描述
optionsIPluginOptions包含 PsConverter 指令的选项对象。

Returns: ResultContainer - An ResultContainer object containing the result of the operation.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

参数类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

参数类型描述
arg0long
arg1int