MetafileRenderingMode Enumeration |
Specifies how Aspose.Words should render WMF and EMF metafiles.
Namespace:
Aspose.Words.Saving
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic enum MetafileRenderingMode
Public Enumeration MetafileRenderingMode
public enum class MetafileRenderingMode
type MetafileRenderingMode
Members
| Member name | Value | Description |
---|
| VectorWithFallback | 0 |
Aspose.Words tries to render a metafile as vector graphics. If Aspose.Words cannot correctly render some of
the metafile records to vector graphics then Aspose.Words renders this metafile to a bitmap.
|
| Vector | 1 |
Aspose.Words renders a metafile as vector graphics.
|
| Bitmap | 2 |
Aspose.Words invokes GDI+ to render a metafile to a bitmap and then saves the bitmap to the output document.
|
ExamplesShows added fallback to bitmap rendering and changing type of warnings about unsupported metafile records.
Document doc = new Document(MyDir + "WMF with image.docx");
MetafileRenderingOptions metafileRenderingOptions =
new MetafileRenderingOptions
{
EmulateRasterOperations = false,
RenderingMode = MetafileRenderingMode.VectorWithFallback
};
HandleDocumentWarnings callback = new HandleDocumentWarnings();
doc.WarningCallback = callback;
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.MetafileRenderingOptions = metafileRenderingOptions;
doc.Save(ArtifactsDir + "PdfSaveOptions.HandleBinaryRasterWarnings.pdf", saveOptions);
Assert.AreEqual(1, callback.Warnings.Count);
Assert.True(callback.Warnings[0].Description.Contains("R2_XORPEN"));
}
public class HandleDocumentWarnings : IWarningCallback
{
public void Warning(WarningInfo info)
{
if (info.WarningType == WarningType.MinorFormattingLoss)
{
Console.WriteLine("Unsupported operation: " + info.Description);
Warnings.Warning(info);
}
}
public WarningInfoCollection Warnings = new WarningInfoCollection();
}
See Also