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 program (VB Script).

' Create HTML2PDF instance:
Set html2pdf_obj = CreateObject("html2pdfx.HTML2PDFX")

' Initiate engine:
html2pdf_obj.StartHTMLEngine "demo", "demo"

' Set PDF filename:
html2pdf_obj.OutputFileName = "report.pdf"

' Set page margins:
html2pdf_obj.MarginLeft = 30
html2pdf_obj.MarginRight = 60
html2pdf_obj.MarginTop = 100
html2pdf_obj.MarginBottom = 50

html2pdf_obj.DocumentTitle = "Sample Report"

html2pdf_obj.BeginDoc

html2pdf_obj.DrawImage 800, -20, "sign.jpg", 1, 1, 0

html2pdf_obj.FontFamily = "Cambria Math"
html2pdf_obj.FontPointSize = 18
html2pdf_obj.DrawText 0, 0, 400, 25, "aligncenter", "R E P O R T", 1, 1, 0

html2pdf_obj.FontFamily = "Times"
html2pdf_obj.FontPointSize = 10

html2pdf_obj.DrawHTML 100, 70, 550, "<p style='text-indent:40px'> This document contains sample report produced by <i><a href='http://www.colorpilot.com/html2pdfaddon.html'>HTML2PDF-X Pilot</a></i> library. The library will help you in a generation of PDF reports using the magic of <a href='http://en.wikipedia.org/wiki/Html'>HTML</a>.</p> </p>The report contains three basic parts: <i><ul><li>The table with data (text, images and hyperlinks);</li><li>The diagram which illustrates table data;</li><li>The description of species from table.</ul></i>", 1, 1, 0

html2pdf_obj.DrawHTML 0, 250, 900, "<table border = '0' valign='middle' align='center'><caption><big><b>Sales in 2012 year:</big></b></caption><tr style='background-color: blue'><th>Serial<br /> num.</th><th>Product name</th><th>Description</th><th>Picture</th><th>Consumers</th><th>Share, %</th></tr>" &_
"<tr style='background-color: #66CCFF'><td align='right'>003</td><td align='center'>Apples</td><td>Apples in boxes - 350 species</td><td><img src='apple.png'></td><td rowspan='5'><a href='http://www.colorpilot.com/Johny.html'>Johny</a>, <a href='http://www.colorpilot.com/Michael.html'>Mike</a></td><td align='center'>36</td></tr>" &_
"<tr style='background-color: #6699FF'><td align='right'>002</td><td align='center'>Coconuts</td><td>Coconuts - 20 species</td><td><img src='coconut.png'><td align='center'>25</td></tr>" &_
"<tr style='background-color: #66CCFF'><td align='right'>001</td><td align='center'>Bananas</td><td>Bananas - 300 species</td><td><img src='banana.png'></td><td align='center'>15</td></tr>" &_
"<tr style='background-color: #6699FF'><td align='right'>004</td><td align='center'>Cherries</td><td>Cherries - 10 kilos</td><td><img src='cherries.png'></td><td align='center'>14</td></tr>" &_
"<tr style='background-color: #66CCFF'><td align='right'>005</td><td align='center'>Lemons</td><td>Lemons in boxes - 30 kilos</td><td><img src='lemon.png'></td><td align='center'>10</td></tr></table>", 1, 1, 0

html2pdf_obj.DrawImage 200, 750, "diagram.jpg", 0.9, 0.9, 0
html2pdf_obj.DrawImage 360, 920, "apple.png", 1, 1, 0
html2pdf_obj.DrawImage 300, 830, "banana.png", 1, 1, 0
html2pdf_obj.DrawImage 380, 810, "lemon.png", 0.7, 0.7, 0
html2pdf_obj.DrawImage 470, 820, "cherries.png", 0.7, 0.7, 0
html2pdf_obj.DrawImage 560, 870, "coconut.png", 1, 1, 0

html2pdf_obj.FontPointSize = 6
html2pdf_obj.DrawHTML 50, 1000, 200,"<a href='http://en.wikipedia.org/wiki/Apple' style='text-decoration:none; color:gray'><p align='justify'>The <b>apple</b> is the pomaceous fruit of the apple tree, species <i>Malus domestica</i> in the rose family (Rosaceae).It is one of the most widely cultivated tree fruits, and the most widely known of the many members of <i>genus Malus</i> that are used by humans.Apples grow on small, deciduous trees. The tree originated in Western Asia, where its wild ancestor, <i>Malus sieversii</i>, is still found today.</p></a>", 1, 1, 0

html2pdf_obj.DrawHTML 50, 700, 200,"<a href='http://en.wikipedia.org/wiki/Banana' style='text-decoration:none; color:gray'><p align='justify'><b>Banana</b> is the common name for herbaceous plants of the <i>genus Musa</i> and for the fruit they produce.It is one of the oldest cultivated plants. They are native to tropical South and Southeast Asia, and are likely to have been first domesticated in Papua New Guinea.Today, they are cultivated throughout the tropics.</p></a>", 1, 1, 0

html2pdf_obj.DrawHTML 300, 650, 200,"<a href='http://en.wikipedia.org/wiki/Lemon' style='text-decoration:none; color:gray'><p align='justify'>The <b>lemon</b> (<i>Citrus + limon</i>) is a small evergreen tree native to Asia, and the tree's ellipsoidal yellow fruit.The fruit's juice, pulp and peel, especially the zest, are used as foods.The juice of the lemon is about 5% to 6% citric acid, which gives lemons a sour taste.</p></a>", 1, 1, 0

html2pdf_obj.DrawHTML 550, 700, 200,"<a href='http://en.wikipedia.org/wiki/Cherry' style='text-decoration:none; color:gray'><p align='justify'>The <b>cherry</b> is the fruit of many plants of the <i>genus Prunus</i>, and is a fleshy stone fruit. The cherry fruits of commerceare usually obtained from a limited number of species, including especially cultivars of the wild cherry, <i>Prunus avium</i>.</p></a>", 1, 1, 0

html2pdf_obj.DrawHTML 600, 1030, 200,"<a href='http://en.wikipedia.org/wiki/Coconut' style='text-decoration:none; color:gray'><p align='justify'>The <b>coconut palm</b>, <i>Cocos nucifera</i>, is a member of the family <i>Arecaceae</i> (palm family).It is the only accepted species in the <i>genus Cocos</i>. The term coconut can refer to the entire coconut palm, the seed, or the fruit, which is not a botanical nut. The spelling cocoanut is an archaic form of the word.</p></a>", 1, 1, 0

html2pdf_obj.FontPointSize = 17
html2pdf_obj.FontStyle = "Italic"
html2pdf_obj.DrawHTML 200, 1200, 800, "<a href='http://www.colorpilot.com/support'>We are glad to hear feedback from you!</a>", 1, 1, 0

html2pdf_obj.EndDoc

Set html2pdf_obj = nothing

CreateObject("WScript.Shell").Run "report.pdf"

 

HTML2PDF-X Pilot sample page

Home Download Samples Tutorials Pricing FAQ History

 

PDF Library | EMF2PDF SDK Pilot | Virtual Printers
HTML2PDF-X Pilot | Converters | PDF Mosaic

Support | Blog
Contact | About | Site map

© 2000-2017, Two Pilots