HTMLDocument.SaveAsync

SaveAsync(string, HTMLSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by path. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(string path, HTMLSaveOptions saveOptions, CancellationToken cancellationToken)
ParameterTypeDescription
pathStringLocal path to output file.
saveOptionsHTMLSaveOptionsHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified path is not a valid local file path.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(Url, HTMLSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by url. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(Url url, HTMLSaveOptions saveOptions, CancellationToken cancellationToken)
ParameterTypeDescription
urlUrlLocal URL to output file.
saveOptionsHTMLSaveOptionsHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified url is not a valid local file URL.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(ResourceHandler, HTMLSaveOptions, CancellationToken)

Asynchronously saves the document content and resources using the ResourceHandler.

public Task SaveAsync(ResourceHandler resourceHandler, HTMLSaveOptions saveOptions, 
    CancellationToken cancellationToken)
ParameterTypeDescription
resourceHandlerResourceHandlerThe resource handler ResourceHandler. Its HandleResourceAsync method is used.
saveOptionsHTMLSaveOptionsHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(string, MarkdownSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by path. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(string path, MarkdownSaveOptions saveOptions, 
    CancellationToken cancellationToken)
ParameterTypeDescription
pathStringLocal path to output file.
saveOptionsMarkdownSaveOptionsMarkdown save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified path is not a valid local file path.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(Url, MarkdownSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by url. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(Url url, MarkdownSaveOptions saveOptions, CancellationToken cancellationToken)
ParameterTypeDescription
urlUrlLocal URL to output file.
saveOptionsMarkdownSaveOptionsMarkdown save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified url is not a valid local file URL.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(ResourceHandler, MarkdownSaveOptions, CancellationToken)

Asynchronously saves the document content and resources using the ResourceHandler.

public Task SaveAsync(ResourceHandler resourceHandler, MarkdownSaveOptions saveOptions, 
    CancellationToken cancellationToken)
ParameterTypeDescription
resourceHandlerResourceHandlerThe resource handler ResourceHandler. Its HandleResourceAsync method is used.
saveOptionsMarkdownSaveOptionsMarkdown save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(string, MHTMLSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by path. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(string path, MHTMLSaveOptions saveOptions, 
    CancellationToken cancellationToken)
ParameterTypeDescription
pathStringLocal path to output file.
saveOptionsMHTMLSaveOptionsMHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified path is not a valid local file path.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(Url, MHTMLSaveOptions, CancellationToken)

Asynchronously saves the document to local file specified by url. All resources used in this document will be saved in to adjacent folder, whose name will be constructed as: output_file_name + “_files”.

public Task SaveAsync(Url url, MHTMLSaveOptions saveOptions, CancellationToken cancellationToken)
ParameterTypeDescription
urlUrlLocal URL to output file.
saveOptionsMHTMLSaveOptionsMHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
ArgumentExceptionRaised if the specified url is not a valid local file URL.
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also


SaveAsync(ResourceHandler, MHTMLSaveOptions, CancellationToken)

Asynchronously saves the document content and resources using the ResourceHandler.

public Task SaveAsync(ResourceHandler resourceHandler, MHTMLSaveOptions saveOptions, 
    CancellationToken cancellationToken)
ParameterTypeDescription
resourceHandlerResourceHandlerThe resource handler ResourceHandler. Its HandleResourceAsync method is used.
saveOptionsMHTMLSaveOptionsMHTML save options.
cancellationTokenCancellationTokenThe cancellation token.

Return Value

A task that represents the asynchronous operation.

Exceptions

exceptioncondition
OperationCanceledExceptionOperation was cancelled.

Remarks

The method returns at once: the document is serialized on the thread pool and the output is written asynchronously. Resources that were not loaded with the document are downloaded during serialization, one after another unless MaxConcurrentRequests is greater than 1.

See Also