ImageResolution

HtmlSaveOptions.ImageResolution property

指定导出为 HTML、MHTML 或 EPUB 时图像的输出分辨率。 默认值为96 dpi.

public int ImageResolution { get; set; }

评论

此属性在以下情况下影响光栅图像ScaleImageToShapeSize真的以及导出为光栅图像的效果图元文件。某些图像属性(例如 cropping 或旋转)需要保存转换后的图像,在这种情况下,转换后的图像将以 given 分辨率创建。

例子

展示如何设置 Aspose.Words 在将文档保存为 HTML 时创建的外部保存资源的文件夹和文件夹别名。

Document doc = new Document(MyDir + "Rendering.docx");

HtmlSaveOptions options = new HtmlSaveOptions
{
    CssStyleSheetType = CssStyleSheetType.External,
    ExportFontResources = true,
    ImageResolution = 72,
    FontResourcesSubsettingSizeThreshold = 0,
    FontsFolder = ArtifactsDir + "Fonts",
    ImagesFolder = ArtifactsDir + "Images",
    ResourceFolder = ArtifactsDir + "Resources",
    FontsFolderAlias = "http://example.com/fonts",
    ImagesFolderAlias = "http://example.com/images",
    ResourceFolderAlias = "http://example.com/resources",
    ExportOriginalUrlForLinkedImages = true
};

doc.Save(ArtifactsDir + "HtmlSaveOptions.FolderAlias.html", options);

也可以看看