Click or drag to resize

WebScraperDownloadImage Method (Uri, String, Int32, Int32, Boolean, HttpIdentity)

Requests a file to be downloaded from the given Url to the local file-system. Often used for scraping documents, assets and images.

Normally called with an Parse Method of IronWebScraper.WebScraper

Namespace:  IronWebScraper
Assembly:  IronWebScraper (in IronWebScraper.dll) Version: 4.0.4.25470 (4.0.4.3)
Syntax
public virtual string DownloadImage(
	Uri uri,
	string path,
	int maxWidth = 0,
	int maxHeight = 0,
	bool overWrite = false,
	HttpIdentity identity = null
)

Parameters

uri
Type: SystemUri
The absolute uri of the resource to be downloaded.
path
Type: SystemString
The path to which the downloaded file should be saved. You may give a directory name or a file name.

Relative paths will be resolved relative to WorkingDirectory.

maxWidth (Optional)
Type: SystemInt32
The Downloaded image will be scaled proportionally to this maximum width. Zero means no constraint.
maxHeight (Optional)
Type: SystemInt32
The Downloaded image will be scaled proportionally to this maximum height. Zero means no constraint.
overWrite (Optional)
Type: SystemBoolean
If set to true any existing file at the given path will be overwritten. If set to false a unique name such as "file(1).html" will be created in the case of a naming conflict.
identity (Optional)
Type: IronWebScraperHttpIdentity
An HttpIdentity to send the Request. If null, the ChooseIdentityForRequest method will be used to find a suitable identity.

Return Value

Type: String
The file path (relative to WorkingDirecory) which the image will be saved to.
See Also