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
Conversion Trigger |
By default, the HTML to PDF converter automatically starts the conversion shortly after all the contents of the page (such as images) are fully loaded.
Sometimes you may need to perform some additional initialization tasks with JavaScript and the conversion should not start until your initialization code is done. In this case you can either increase HtmlToPdf.Options.MinLoadWaitTime to give the JavaScript code more time to run, or manually trigger the conversion from JavaScript.
To manually trigger conversion from JavaScript, you must:
- Set HtmlToPdf.Options.TriggerMode to Manual or Dual;
-
Call convert method on eoapi to notify the HTML to PDF converter to start the conversion;
JavaScript//Start the conversion. Note that this is only necessary //when HtmlToPdf.Options.TriggerMode is set Manual or Dual. //The default value is Auto, so the conversion starts //automatically. //You may also use variable "eoapi" to check whether the page //is running inside the converter so that the custom triggering //code will not run inside a regular browser because variable //"eoapi" does not exist in a regular browser if (window.eoapi && eoapi.isEOPdf()) eoapi.convert();
It is important to understand that:
- It is only necessary to call eoapi.convert() when you have explicitly set HtmlToPdf.Options.TriggerMode to Manual or Dual. The default value is Auto, which means the conversion starts automatically shortly after the page contents are loaded;
- Once you set HtmlToPdf.Options.TriggerMode to Manual or Dual, you must call eoapi.convert() in order for the conversion to start, otherwise the conversion will time out and fail;
- If you set HtmlToPdf.Options.TriggerMode to Dual, the converter will still wait for page contents to be loaded even after eoapi.convert() is called.