ConvertToImages

ConvertToImages(string, SaveFormat)

将指定输入文件的页面转换为指定格式的图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(string inputFile, SaveFormat saveFormat)
范围类型描述
inputFileString输入文件名。
saveFormatSaveFormat保存格式。仅允许图像保存格式。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档转换为图像流。

string doc = MyDir + "Big document.docx";

Stream[] streams = Converter.ConvertToImages(doc, SaveFormat.Png);

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
imageSaveOptions.PageSet = new PageSet(1);
streams = Converter.ConvertToImages(doc, imageSaveOptions);

streams = Converter.ConvertToImages(new Document(doc), SaveFormat.Png);

streams = Converter.ConvertToImages(new Document(doc), imageSaveOptions);

也可以看看


ConvertToImages(string, ImageSaveOptions)

使用指定的保存选项将指定输入文件的页面转换为图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(string inputFile, ImageSaveOptions saveOptions)
范围类型描述
inputFileString输入文件名。
saveOptionsImageSaveOptions图像保存选项。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档转换为图像流。

string doc = MyDir + "Big document.docx";

Stream[] streams = Converter.ConvertToImages(doc, SaveFormat.Png);

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
imageSaveOptions.PageSet = new PageSet(1);
streams = Converter.ConvertToImages(doc, imageSaveOptions);

streams = Converter.ConvertToImages(new Document(doc), SaveFormat.Png);

streams = Converter.ConvertToImages(new Document(doc), imageSaveOptions);

也可以看看


ConvertToImages(Stream, SaveFormat)

将指定输入流的页面转换为指定格式的图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(Stream inputStream, SaveFormat saveFormat)
范围类型描述
inputStreamStream输入流。
saveFormatSaveFormat保存格式。仅允许图像保存格式。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档从流转换为图像。

using (FileStream streamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
    Stream[] streams = Converter.ConvertToImages(streamIn, SaveFormat.Jpeg);

    ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
    imageSaveOptions.PageSet = new PageSet(1);
    streams = Converter.ConvertToImages(streamIn, imageSaveOptions);

    LoadOptions loadOptions = new LoadOptions() { IgnoreOleData = false };
    Converter.ConvertToImages(streamIn, loadOptions, imageSaveOptions);
}

也可以看看


ConvertToImages(Stream, ImageSaveOptions)

使用指定的保存选项将指定输入流的页面转换为图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(Stream inputStream, ImageSaveOptions saveOptions)
范围类型描述
inputStreamStream输入流。
saveOptionsImageSaveOptions图像保存选项。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档从流转换为图像。

using (FileStream streamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
    Stream[] streams = Converter.ConvertToImages(streamIn, SaveFormat.Jpeg);

    ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
    imageSaveOptions.PageSet = new PageSet(1);
    streams = Converter.ConvertToImages(streamIn, imageSaveOptions);

    LoadOptions loadOptions = new LoadOptions() { IgnoreOleData = false };
    Converter.ConvertToImages(streamIn, loadOptions, imageSaveOptions);
}

也可以看看


ConvertToImages(Stream, LoadOptionsImageSaveOptions)

使用提供的加载和保存选项将指定输入流的页面转换为图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(Stream inputStream, LoadOptions loadOptions, 
    ImageSaveOptions saveOptions)
范围类型描述
inputStreamStream输入流。
loadOptionsLoadOptions输入文档加载选项。
saveOptionsImageSaveOptions图像保存选项。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档从流转换为图像。

using (FileStream streamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
    Stream[] streams = Converter.ConvertToImages(streamIn, SaveFormat.Jpeg);

    ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
    imageSaveOptions.PageSet = new PageSet(1);
    streams = Converter.ConvertToImages(streamIn, imageSaveOptions);

    LoadOptions loadOptions = new LoadOptions() { IgnoreOleData = false };
    Converter.ConvertToImages(streamIn, loadOptions, imageSaveOptions);
}

也可以看看


ConvertToImages(DocumentSaveFormat)

将指定文档的页面转换为指定格式的图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(Document doc, SaveFormat saveFormat)
范围类型描述
docDocument输入文档。
saveFormatSaveFormat保存格式。仅允许图像保存格式。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档转换为图像流。

string doc = MyDir + "Big document.docx";

Stream[] streams = Converter.ConvertToImages(doc, SaveFormat.Png);

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
imageSaveOptions.PageSet = new PageSet(1);
streams = Converter.ConvertToImages(doc, imageSaveOptions);

streams = Converter.ConvertToImages(new Document(doc), SaveFormat.Png);

streams = Converter.ConvertToImages(new Document(doc), imageSaveOptions);

也可以看看


ConvertToImages(DocumentImageSaveOptions)

使用指定的保存选项将指定文档的页面转换为图像,并返回包含图像的流数组。

public static Stream[] ConvertToImages(Document doc, ImageSaveOptions saveOptions)
范围类型描述
docDocument输入文档。
saveOptionsImageSaveOptions图像保存选项。

返回值

返回图像流数组。这些流应由最终用户处理。

例子

展示如何将文档转换为图像流。

string doc = MyDir + "Big document.docx";

Stream[] streams = Converter.ConvertToImages(doc, SaveFormat.Png);

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
imageSaveOptions.PageSet = new PageSet(1);
streams = Converter.ConvertToImages(doc, imageSaveOptions);

streams = Converter.ConvertToImages(new Document(doc), SaveFormat.Png);

streams = Converter.ConvertToImages(new Document(doc), imageSaveOptions);

也可以看看