Components for Developers
© 2000-2017, Two Pilots

PDF Library   EMF2PDF SDK Pilot   Virtual Printers   HTML2PDF-X Pilot   Converters   PDF Mosaic  
Home Download Samples Tutorials Pricing FAQ History

HTML2PDF-X Pilot

 

Sample Usage from MS Office documents (VBA)

 

This page provides a tutorial to help you use HTML2PDF-X Pilot library with MS Office applications.

Install HTML2PDF-X library on your computer. Create an MS Word (.doc or .docx) document. Open the document and press Alt+F11 to open the Microsoft Visual Basic editor. Add HTML2PDF-X object as a reference to the document:

  1. Open a module window in the VBA application. This can be an Event Procedure, Function, or Sub.
  2. On the Tools menu, click References. If the references selection in the application you are using is not on this menu, search online help for the keyword, “references.”
  3. Select "html2pdfx Type library 1.0" from the list
  4. Insert the following VBA-code into the Sub, Function, or Event Procedure (a button click event procedure would be a good example) you intend to use:

Sub script()
MsgBox "Example of HTML2PDF-X use from VBA"

'Create an object reference to the component 
Dim html2pdf_obj As HTML2PDFX
Dim result As Long

'Create an instance of the object
Set html2pdf_obj = New HTML2PDFX

'Use HTML2PDF-X library 
html2pdf_obj.StartHTMLEngine "demo", "demo" 
html2pdf_obj.OutputFileName = "C:/doc.pdf"
html2pdf_obj.SlicingMode = false

html2pdf_obj.BeginDoc
html2pdf_obj.BaseURL = "http://www.colorpilot.com"
html2pdf_obj.LoadURL http://www.colorpilot.com
html2pdf_obj.ContentZoomFactor = 80
html2pdf_obj.ConvertAll
html2pdf_obj.DrawText 450, 200, 300, 40, "aligncenter", "Sample Text", 1, 1, 0
html2pdf_obj.EndDoc

End Sub 

 

HTML2PDF-X Pilot main page

Home Download Samples Tutorials Pricing FAQ History

 

PDF Library | Virtual Printers | Converters
Help Creator | Web Form Maker |

Support | Blog | Forum | Press
Contacts | About | Site map

© 2000-2017, Two Pilots