Home Download Samples Tutorials Pricing FAQ History
This page provides example code to help you to use HTML2PDF-X Pilot library from a web page with Internet Explorer. This option may be wise to use only on your company’s intranet. Enabling unsafe ActiveX usage for use outside your company’s internal network might create a security hole.
To enable using ActiveX from a web page, change the security setting in Internet Explorer to allow such access:
Tools->Internet Options->Security->Custom Level…->ActiveX controls and plug-ins->Initialize and script ActiveX controls not marked as safe for scripting : Enabled.
WARNING: You should set this only if you are certain that the control in your page is safe.
To use HTML2PDF-X Pilot create an HTML file with the following content:
<html> <body> <object id="html2pdfx" name="html2pdfx" classid="CLSID:AB20683F-3F22-4B72-B61E-29A89BB5D994" width = "0" height = "0"> </object> <script> function button_Click() { alert('Begin generation of test document.'); html2pdfx.StartHTMLEngine("demo", "demo"); html2pdfx.SlicingMode = false; html2pdfx.OutputFileName = "C:/document.pdf"; html2pdfx.BeginDoc(); html2pdfx.BaseURL = https://www.colorpilot.com ; html2pdfx.LoadURL("https://www.colorpilot.com"); html2pdfx.ContentZoomFactor = 80; html2pdfx.ConvertAll(); html2pdfx.DrawText(450, 200, 300, 40 "aligncenter", "Sample Text", 1, 1, 0); html2pdfx.EndDoc(); } </script> <form id="form1" runat="server"> Please click the button to test HTML2PDF-X: <input type="button" id="btn" onclick="button_Click()" value="Generate PDF document"/> </form> </body> </html>
Open the web-page you’ve just created with Internet Explorer and click “Generate PDF document”. HTML2PDF-X will generate pdf from html.