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

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

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

Sample Code

This sample code shows how to send HTTP headers 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 headers
converter.Options.HttpHeaders.Add(TxtName1.Text, TxtValue1.Text);
converter.Options.HttpHeaders.Add(TxtName2.Text, TxtValue2.Text);
converter.Options.HttpHeaders.Add(TxtName3.Text, TxtValue3.Text);
converter.Options.HttpHeaders.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