Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
    • .NET API Reference
      • EO.Base
      • EO.Base.UI
      • EO.Extensions
      • EO.Pdf
        • EO.Pdf
        • Classes
          • ClientCertificate Class
          • HtmlDocument Class
          • HtmlElement Class
          • HtmlNode Class
          • HtmlTextNode Class
          • HtmlToPdf Class
          • HtmlToPdfException Class
          • HtmlToPdfOptions Class
          • HtmlToPdfResult Class
          • HtmlToPdfSession Class
          • PageInfo Class
          • PageInfoCollection Class
          • PageStyle Class
          • Paginator Class
          • PdfAction Class
          • PdfAttachment Class
          • PdfAttachmentCollection Class
          • PdfBookmark Class
          • PdfBookmarkCollection Class
          • PdfCheckBoxField Class
          • PdfComboBoxField Class
          • PdfDestination Class
          • PdfDocInfo Class
          • PdfDocument Class
          • PdfDocumentEventArgs Class
          • PdfDocumentSecurity Class
          • PdfField Class
          • PdfFieldCollection Class
          • PdfGenericField Class
          • PdfGoToAction Class
          • PdfJavaScriptAction Class
          • PdfLaunchAction Class
          • PdfLink Class
          • PdfListBoxField Class
          • PdfListField Class
          • PdfListItem Class
          • PdfListItemCollection Class
          • PdfObject Class
          • PdfOnOffField Class
          • PdfPage Class
          • PdfPageCollection Class
          • PdfPageEventArgs Class
          • PdfPageLocation Class
          • PdfPageRectangle Class
          • PdfPageSizes Class
          • PdfPortfolio Class
          • PdfPushButtonField Class
          • PdfRadioButtonField Class
          • PdfRadioButtonGroup Class
          • PdfRender Class
          • PdfSigner Class
          • PdfTextField Class
          • PdfUriAction Class
          • PdfViewerException Class
          • PdfViewerPreference Class
          • Runtime Class
          • YRange Class
        • Interfaces
        • Enumerations
        • Delegates
      • EO.Pdf.Acm
      • EO.Pdf.Contents
      • EO.Pdf.Drawing
      • EO.Pdf.Mvc
      • EO.Web
      • EO.WebBrowser
      • EO.WebBrowser.DOM
      • EO.WebEngine
      • EO.WinForm
      • EO.Wpf
      • EO.Wpf.Gauge
      • EO.Wpf.Gauge.Shapes
      • EO.Wpf.Primitives
      • EO.Wpf.Themes.Aero
      • EO.Wpf.Themes.Classic
      • EO.Wpf.Themes.Luna
      • EO.Wpf.Themes.Metro
      • EO.Wpf.Themes.Royale
    • JavaScript API Reference
HtmlToPdfSession.GetCookies Method 

Gets the current cookie collections.

Syntax
 public CookieCollection GetCookies();
Remarks

One of the primary purpose of the HtmlToPdfSession class is to simulate an interactive session (such as user log in) in order to get the result cookies. For example, the following code simulate a log in and then get the user's authentication cookies:

//Create a new HtmlToPdfSession object
using (HtmlToPdfSession session = HtmlToPdfSession.Create())
{

    //Load the login page
    session.LoadUrl("http://www.yoursite.com/Login.html");

    //Fill in the "username" and "password" form fields
    session.Fill("username", "test1234");
    session.Fill("password", "abcxyz");

    //Submit the page back to the server. If the login is
    //successful, this reloads the page with the newly issued
    //authentication cookies
    session.Submit();

    //Get all the cookies and pass these cookies to the HTML
    //to PDF converter
    HtmlToPdf.Options.Cookies = session.GetCookies();
}

//Call the HTML to PDF converter to convert a page. Since
//the HTML to PDF converter has the cookies, it would
//function as it has already logged in
HtmlToPdf.ConvertUrl("http://www.yoursite.com/OrderHistory.html", "orders.pdf");

Note that you only need to use this method if you wish to keep the cookies and use them later. If you just need to convert the page right away, you can load that page directly into the HtmlToPdfSession object and call RenderAsPDF to convert the page immediately. See using HtmlToPdfSession for more details.

See Also