Sending Parameters with a HTTP POST Request | |
By default, when a page is converted to PDF, SelectPdf performs a GET request for that page to obtain its content. SelectPdf Library for .NET can be used to send additional parameters to the web page that is converted using a HTTP POST request.
This can be done using the HttpPostParameters property of the HtmlToPdfOptions object.
This sample shows how to send parameters using a HTTP POST request to the page that will be converted using the html to pdf converter from SelectPdf Pdf Library for .NET.
// instantiate a html to pdf converter object HtmlToPdf converter = new HtmlToPdf(); // set the HTTP POST parameters converter.Options.HttpPostParameters.Add(name1, value1); converter.Options.HttpPostParameters.Add(name2, value2); converter.Options.HttpPostParameters.Add(name3, value3); converter.Options.HttpPostParameters.Add(name4, value4); // create a new pdf document converting an url PdfDocument doc = converter.ConvertUrl(url); // save pdf document doc.Save("Sample.pdf"); // close pdf document doc.Close();