HTML2PDF-X Pilot – Sample Usage from HTML (in Internet Explorer only)

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:

<object id="html2pdfx" name="html2pdfx" classid="CLSID:AB20683F-3F22-4B72-B61E-29A89BB5D994" width = "0" height = "0">
function button_Click()
       alert('Begin generation of test document.');
       html2pdfx.StartHTMLEngine("demo", "demo");
       html2pdfx.SlicingMode = false;
       html2pdfx.OutputFileName = "C:/document.pdf";
       html2pdfx.BaseURL = ;
       html2pdfx.ContentZoomFactor = 80;
       html2pdfx.DrawText(450, 200, 300,  40 "aligncenter", "Sample Text", 1, 1, 0);
<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"/>


Open the web-page you’ve just created with Internet Explorer and click “Generate PDF document”. HTML2PDF-X will create test PDF file.


Home       Download       Samples       Tutorials       Pricing       FAQ       History