EmfOptions

EmfOptions class

Emf 选项。

public class EmfOptions : MetafileOptions

构造函数

姓名描述
EmfOptions()默认构造函数。

特性

姓名描述
BufferSizeHint { get; set; }获取或设置缓冲区大小提示,该提示定义了所有内部缓冲区的最大允许大小。
Compress { get; set; }获取或设置一个值,该值指示是否ICompressedOptions被压缩。
Disposed { get; }获取一个值,该值指示此实例是否被释放。
FullFrame { get; set; }获取或设置一个值,指示是否[全帧].
MultiPageOptions { get; set; }多页选项
virtual Palette { get; set; }获取或设置调色板。
ProgressEventHandler { get; set; }获取或设置进度事件处理程序。
virtual ResolutionSettings { get; set; }获取或设置分辨率设置。
Source { get; set; }获取或设置要在其中创建图像的源。
VectorRasterizationOptions { get; set; }获取或设置矢量光栅化选项。
virtual XmpData { get; set; }获取或设置 XMP 元数据容器。

方法

姓名描述
virtual Clone()克隆此实例。
Dispose()处理当前实例。

例子

以下示例显示如何将 emz 图像转换为 emf fromat

[C#]

string file = "example.emz";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".emf";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
    Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.EmfRasterizationOptions {PageSize = image.Size};
    image.Save(outFile, new Aspose.Imaging.ImageOptions.EmfOptions {VectorRasterizationOptions = vectorRasterizationOptions});
}

以下示例显示如何将 emf 图像转换为 emz fromat

[C#]

string file = "input.emf";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".emz";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
    Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.EmfRasterizationOptions() { PageSize = image.Size};
    image.Save(outFile, new Aspose.Imaging.ImageOptions.EmfOptions() {VectorRasterizationOptions = vectorRasterizationOptions, Compress = true});
}

以下示例显示了如何在不引用特定图像类型的情况下以一般方式将多页矢量图像转换为 EMF 格式。

[C#]

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.emf");

Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.EmfOptions();

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
    exportOptions.MultiPageOptions = null;

    // 只导出前两页。事实上,只有一页会被转换,因为 EMF 不是多页格式。
    Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
    if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
    {
        exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
    }

    if (image is Aspose.Imaging.VectorImage)
    {
        exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
        exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
        exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
    }

    image.Save(outputFilePath, exportOptions);
}

也可以看看