HiQPdf Documentation

Add HTTP Cookies when Accessing Web Page

Quickly Create High Quality PDFs

The HiQPdf HTML Converters and the HTML Objects can be configured to transmit a set of HTTP cookies to web server when requesting the web page to convert. For example, the HTTP cookies to be transmitted to web server are added to the HttpCookies collection of the HiQPdf.HtmlToPdf object using the HttpCookiesCollectionAddCookie(String, String) method which takes as parameter the cookie name and the cookie value. Adding custom HTTP cookies to a request can have interesting applications. For example the custom cookies can be used to Handle Forms Authentication. Below there is a simple sample code for adding a cookie to request.

Example

C#
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// add a cookie to request
htmlToPdfConverter.HttpCookies.AddCookie("cookieName", "cookieValue");
See Also

Other Resources