Click or drag to resize
Pdf Library for .NET
Sending HTTP Cookies with Html to Pdf Converter

Select.Pdf Library for .NET can be used to send additional HTTP cookies to the web page that is converted.

This can be done using the HttpCookies property of the HtmlToPdfOptions object.

Sample Code

This sample code shows how to send HTTP cookies to the page that will be converted using the html to pdf converter from Select.Pdf Pdf Library for .NET.

// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();

// set the HTTP cookies
converter.Options.HttpCookies.Add(TxtName1.Text, TxtValue1.Text);
converter.Options.HttpCookies.Add(TxtName2.Text, TxtValue2.Text);
converter.Options.HttpCookies.Add(TxtName3.Text, TxtValue3.Text);
converter.Options.HttpCookies.Add(TxtName4.Text, TxtValue4.Text);

// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl(TxtUrl.Text);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
See Also