Class MhtmlRenderingOptions

Class MhtmlRenderingOptions

Namespace: Aspose.Html.Rendering
Assembly: Aspose.HTML.dll (26.3.0)

Represents options for rendering MHTML documents with attachment selection.

[ComVisible(true)]
public class MhtmlRenderingOptions

Inheritance

object MhtmlRenderingOptions

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

MhtmlRenderingOptions()

Initializes a new instance of the Aspose.Html.Rendering.MhtmlRenderingOptions class.

public MhtmlRenderingOptions()

Properties

ExcludedAttachments

Gets the set of attachment URLs to exclude from rendering. Only used when Aspose.Html.Rendering.MhtmlRenderingOptions.RenderAllAttachments is true.

public ISet<string> ExcludedAttachments { get; }

Property Value

ISet < string >

RenderAllAttachments

Gets or sets a value indicating whether to render all attachments found in the MHTML document. When true (default), all attachments are rendered. When false, only explicitly selected attachments are rendered.

public bool RenderAllAttachments { get; set; }

Property Value

bool

SelectedAttachments

Gets the set of attachment URLs to include for rendering. Only used when Aspose.Html.Rendering.MhtmlRenderingOptions.RenderAllAttachments is false.

public ISet<string> SelectedAttachments { get; }

Property Value

ISet < string >

Methods

ExcludeAttachment(string)

Excludes a specific attachment from rendering by its URL. Only used when Aspose.Html.Rendering.MhtmlRenderingOptions.RenderAllAttachments is true.

public void ExcludeAttachment(string attachmentUrl)

Parameters

attachmentUrl string

The URL of the attachment to exclude.

Exceptions

ArgumentNullException

Thrown when attachmentUrl is null.

ArgumentException

Thrown when attachmentUrl is empty.

ExcludeAttachments(IEnumerable<string>)

Excludes multiple attachments from rendering by their URLs. Only used when Aspose.Html.Rendering.MhtmlRenderingOptions.RenderAllAttachments is true.

public void ExcludeAttachments(IEnumerable<string> attachmentUrls)

Parameters

attachmentUrls IEnumerable < string >

An enumerable collection of attachment URLs to exclude.

Exceptions

ArgumentNullException

Thrown when attachmentUrls is null.

Reset()

Clears all attachment selection/exclusion settings and restores default behavior.

public void Reset()

SelectAttachment(string)

Selects a specific attachment for rendering by its URL.

public void SelectAttachment(string attachmentUrl)

Parameters

attachmentUrl string

The URL of the attachment to select.

Exceptions

ArgumentNullException

Thrown when attachmentUrl is null.

ArgumentException

Thrown when attachmentUrl is empty.

SelectAttachments(IEnumerable<string>)

Selects multiple attachments for rendering by their URLs.

public void SelectAttachments(IEnumerable<string> attachmentUrls)

Parameters

attachmentUrls IEnumerable < string >

An enumerable collection of attachment URLs to select.

Exceptions

ArgumentNullException

Thrown when attachmentUrls is null.

ShouldRenderAttachment(string)

Determines whether a specific attachment should be rendered based on the current options.

public bool ShouldRenderAttachment(string attachmentUrl)

Parameters

attachmentUrl string

The URL of the attachment to check.

Returns

bool

true if the attachment should be rendered; otherwise, false.

Exceptions

ArgumentNullException

Thrown when attachmentUrl is null.