When converting a HTML document from a given URL, the HTML converters will access the document using the GET HTTP method by default. The HiQPdf HTML Converters and the HTML Objects can also be configured to access the web page to convert using the POST HTTP method and to transmit a set of fields to the web server. For example, the HTTP POST fields to be transmitted to web server are added to the HttpPostFields collection of the HiQPdf.HtmlToPdf object using the HttpPostFieldsCollectionAddPostField(String, String) method which takes as parameter the field name and the field value. If the collection is not empty the converter will make a POST request to the web page URL with the fields from this collection. If the POST fields collection is empty the converter will make a default GET request.
Examples
In the code sample below, the HTML to PDF Converter is configured to make a POST HTTP request with the 'FieldName1' and 'FieldName 2' fields. The fields names and values are automatically URL encoded before they are transmitted to the web server:
// create the HTML to PDF converter HtmlToPdf htmlToPdfConverter = new HtmlToPdf(); // set the HTTP POST fields to be transmitted to the web server htmlToPdfConverter.HttpPostFields.AddPostField("FieldName1", "FieldValue1"); htmlToPdfConverter.HttpPostFields.AddPostField("FieldName 2", "FieldValue 2");