Click or drag to resize
Pdf Library for .NET

LoginOptions Class

Drives an interactive, form-based login the converter performs before rendering a protected page: it navigates to LoginPage, types Username and Password into the fields identified by the CSS selectors, and clicks the submit button. Reached through LoginOptions. Use this for pages behind an HTML login form; use Authentication for HTTP authentication.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalLoginOptions

Namespace: SelectPdf.Universal
Assembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntax
public class LoginOptions

The LoginOptions type exposes the following members.

Constructors
 NameDescription
Public methodLoginOptions 
Top
Properties
 NameDescription
Public propertyDelayAfter Gets or sets the delay, in seconds, inserted after the login form is submitted, allowing the protected page to load. Defaults to 20.
Public propertyDelayBefore Gets or sets the delay, in seconds, inserted before the login form is submitted. Defaults to 20.
Public propertyLoginPage Gets or sets the URL of the login page the converter opens to perform the login.
Public propertyPassword Gets or sets the password typed into the password field during login.
Public propertyPasswordFieldSelector Gets or sets the CSS selector that identifies the password input field on the login page.
Public propertySubmitButtonSelector Gets or sets the CSS selector that identifies the submit button on the login page.
Public propertyUsername Gets or sets the user name typed into the user name field during login.
Public propertyUsernameFieldSelector Gets or sets the CSS selector that identifies the user name input field on the login page.
Top
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.LoginOptions.LoginPage = "https://example.com/login";
converter.Options.LoginOptions.UsernameFieldSelector = "#user";
converter.Options.LoginOptions.PasswordFieldSelector = "#pass";
converter.Options.LoginOptions.SubmitButtonSelector = "#submit";
converter.Options.LoginOptions.Username = "user";
converter.Options.LoginOptions.Password = "secret";
PdfDocument doc = converter.ConvertUrl("https://example.com/dashboard");
doc.Save("out.pdf");
doc.Close();
See Also