Aspose::Words::Saving::MetafileRenderingOptions class
Contents
[
Hide
]MetafileRenderingOptions class
Allows to specify additional metafile rendering options. To learn more, visit the Handling Windows Metafiles documentation article.
class MetafileRenderingOptions : public System::Object
Methods
Method | Description |
---|---|
get_EmfPlusDualRenderingMode() const | Gets or sets a value determining how EMF+ Dual metafiles should be rendered. |
get_EmulateRasterOperations() const | Gets or sets a value determining whether or not the raster operations should be emulated. |
get_EmulateRenderingToSizeOnPage() const | Gets or sets a value determining whether metafile rendering emulates the display of the metafile according to the size on page or the display of the metafile in its default size. |
get_EmulateRenderingToSizeOnPageResolution() const | Gets or sets the resolution in pixels per inch for the emulation of metafile rendering to the size on page. |
get_RenderingMode() const | Gets or sets a value determining how metafile images should be rendered. |
get_UseEmfEmbeddedToWmf() const | Gets or sets a value determining how WMF metafiles with embedded EMF metafiles should be rendered. |
get_UseGdiRasterOperationsEmulation() const | Gets or sets a value determining whether or not to use the GDI+ for raster operations emulation. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
MetafileRenderingOptions() | |
set_EmfPlusDualRenderingMode(Aspose::Words::Saving::EmfPlusDualRenderingMode) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_EmfPlusDualRenderingMode. |
set_EmulateRasterOperations(bool) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_EmulateRasterOperations. |
set_EmulateRenderingToSizeOnPage(bool) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_EmulateRenderingToSizeOnPage. |
set_EmulateRenderingToSizeOnPageResolution(int32_t) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_EmulateRenderingToSizeOnPageResolution. |
set_RenderingMode(Aspose::Words::Saving::MetafileRenderingMode) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_RenderingMode. |
set_UseEmfEmbeddedToWmf(bool) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_UseEmfEmbeddedToWmf. |
set_UseGdiRasterOperationsEmulation(bool) | Setter for Aspose::Words::Saving::MetafileRenderingOptions::get_UseGdiRasterOperationsEmulation. |
static Type() |
Examples
Shows added a fallback to bitmap rendering and changing type of warnings about unsupported metafile records.
void HandleBinaryRasterWarnings()
{
auto doc = MakeObject<Document>(MyDir + u"WMF with image.docx");
auto metafileRenderingOptions = MakeObject<MetafileRenderingOptions>();
// Set the "EmulateRasterOperations" property to "false" to fall back to bitmap when
// it encounters a metafile, which will require raster operations to render in the output PDF.
metafileRenderingOptions->set_EmulateRasterOperations(false);
// Set the "RenderingMode" property to "VectorWithFallback" to try to render every metafile using vector graphics.
metafileRenderingOptions->set_RenderingMode(MetafileRenderingMode::VectorWithFallback);
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF and applies the configuration
// in our MetafileRenderingOptions object to the saving operation.
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_MetafileRenderingOptions(metafileRenderingOptions);
auto callback = MakeObject<ExPdfSaveOptions::HandleDocumentWarnings>();
doc->set_WarningCallback(callback);
doc->Save(ArtifactsDir + u"PdfSaveOptions.HandleBinaryRasterWarnings.pdf", saveOptions);
ASSERT_EQ(1, callback->Warnings->get_Count());
ASSERT_EQ(u"'R2_XORPEN' binary raster operation is not supported.", callback->Warnings->idx_get(0)->get_Description());
}
class HandleDocumentWarnings : public IWarningCallback
{
public:
SharedPtr<WarningInfoCollection> Warnings;
void Warning(SharedPtr<WarningInfo> info) override
{
if (info->get_WarningType() == WarningType::MinorFormattingLoss)
{
std::cout << (String(u"Unsupported operation: ") + info->get_Description()) << std::endl;
Warnings->Warning(info);
}
}
HandleDocumentWarnings() : Warnings(MakeObject<WarningInfoCollection>())
{
}
};
See Also
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++