Saving a Document


The SaveOptions is a base options class for saving operations. It could help you to manage the linked resources. The following table demonstrates the list of available options:

Option Description
UrlRestriction Applies restrictions to the host or folders where resources are located.
MaxHandlingDepth If you need to save not the only specified HTML document, but also the linked HTML pages, this option gives you the ability to control the depth of the linked pages that should be saved.
JavaScript This option specifies how do we need to treat the JavaScript files: it could be saved as a separated linked file, embed into HTML file or even be ignored.
Default This options specifies behavior for other than JavaScript files.


Once you have finished your changes as it is described here, you may want to save the document. The following example is the easiest way to save HTML file:

The sample above is quite simple. However, in real-life applications you often need additional control over the saving process. The next few sections describe how to use resource handling options or save you document to the different formats.

HTML to File

The following code snippet shows how to use ResourceHandlingOptions to manage linked to your document files.


In some cases you need to save your document as a single file. MHTML document could be very useful for this purpose since it is a web-page archive and it is store everything inside itself.

As well as for HTML to File example, you can use MHTMLSaveOptions and customize the required handling options.

HTML to Markdown

MD is a markup language with plain-text syntax. In order to create Markdown files by using Aspose.HTML, please take a look at following example:

For the more information how to use Markdown Converter, please visit HTML to Markdown article.

Save SVG

Usually, you could see the SVG document as a part of HTML file, it is used to represent the vector data on the page: images, icons, tables, etc. However, SVG also could be extracted from the web page and you can manipulate it in a similar way as the HTML document.

Since SVGDocument and HTMLDocument are based on the same WHATWG DOM standard, the all operations such as loading, reading, editing, converting and saving are similar for both documents. So, the all examples where you can see manipulation with HTMLDocument are applicable for SVGDocument as well.

In order to save your changes, please use as it follows: