Method SaveWebPage
- Namespace
- DotNetBrowser.Browser
- Assembly
- DotNetBrowser.dll
SaveWebPage(string, string, SavePageType)
Initiates the saving process of the currently loaded web page. The web page can be saved as a single HTML file or the file with resources. Before saving a web page make sure that it is not being loaded. It is recommended to completely loaded the web page and only then save it.
bool SaveWebPage(string filePath, string resourcesPath, SavePageType saveType)
Parameters
filePath
stringan absolute path to a file in which the web page will be saved.
resourcesPath
stringan absolute path to a directory in which the resources (e.g. images, css) of the web page will be saved. If the directory does not exist, it will be created
saveType
SavePageTypedetermines how the web page will be saved: as an HTML file with all the required resources (e.g. images, css etc.), a single HTML or MHTML file
Returns
- bool
true
if the saving process has been initialized successfully,false
otherwise.
Exceptions
- ObjectDisposedException
The IBrowser has already been disposed.
- ConnectionClosedException
The connection to the Chromium engine is closed.
- ArgumentException
The
filePath
is null, empty, or consists only of white-space characters.- ArgumentException
The
resourcesPath
is null, empty, or consists only of white-space characters.