Table of Contents
- Getting Started
- EO.Pdf
- Overview
- Installation and Deployment
- Using HTML to PDF
- Using HTML to PDF
- Quick Start
- Setting Page Size and Margins
- Resizing Output
- Output Paging
- Web Page Authentication
- HTTP Post and Headers
- JavaScript in HTML
- Conversion Trigger
- Links in HTML
- Page Header and Footer
- Partial Page Conversion
- Repeating Table Header and Footer
- Merging Multiple HTML pages
- Generating Page Images
- Using with PDF Creator
- Creating Interactive Form Elements
- Working with Secure Pages
- Using HtmlToPdfSession object
- Troubleshooting HTML to PDF
- Debugging HTML to PDF
- Using PDF Creator
- Working with Existing PDF Files
- Using in Web Application
- Advanced Topics
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
HTTP Post and Headers |
Overview
You can post form data to the server or add additional headers if necessary. This section covers the following topics:
Calling HtmlToPdfOptions.AddPostData
Setting HtmlToPdfOptions.PostData
Calling HtmlToPdfOptions.AddPostData
The easiest way to post form data is to call AddPostData to add your form variables. For example, the following code posts several form variables to the server:
//Post address information to an Url to generate an address form EO.Pdf.HtmlToPdf.Options.AddPostData("addr1", "1234 Abc Road"); EO.Pdf.HtmlToPdf.Options.AddPostData("addr2", "Suite 567"); EO.Pdf.HtmlToPdf.Options.AddPostData("City", "New York City"); EO.Pdf.HtmlToPdf.Options.AddPostData("State", "NY"); EO.Pdf.HtmlToPdf.Options.AddPostData("ZipCode", "33221"); HtmlToPdf.ConvertUrl(url, "c:\\test.pdf");
Setting HtmlToPdfOptions.PostData
You can also set the encoded post data directly through HtmlToPdfOptions's PostData property. When PostData is set, data added through AddPostData are ignored.
Additional Headers
You can set HtmlToPdfOptions's AdditionalHeaders property to send additional headers to the server. The following code sends two additional headers:
//Add additional headers for referer and cookies EO.Pdf.HtmlToPdf.Options.AdditionalHeaders = new string[] { "Referer: http://www.essentialobjects.com", "Accept-Charset: iso-8859-5", };