CollinsHTML.js 100%
JavaScript
HTML Parser with output to PDF (version 1.3)
Client or Server side PDF generation
FREE DOWNLOAD
Updated July 20, 2010
textbox
See also: Free
Download CollinsPDF.js which contains other examples specific to the PDF
object
on-line Example :
HTML to
PDF with a set of pre-built HTML examples
on-line Example : HTML
Editor
with
output to PDF
The purpose of the HTML to PDF system is to create
permanent / printable / paginated / version-able documents, these include, but
not limited to, Quotes, Rate Sheets, Invoices, Purchase Orders, Work
Orders, Bill of Laden, Terms and Conditions, Organization Charts, Tests, and
Database Reports. '
The CollinsHTML JavaScript is an independent self
contained HTML parser. The only current output of the script is to use the
CollinsPDF script to create PDF files, (see
writeToPdf(pdf) ).
The function toString()
still in development,
will create browser independent HTML from the more complex HTML by converting it
to standard HTML tags, this is to include graphic commands, calendars, database
reports, graphs, charts and macros..
Capabilities of CollinsHTML for the creation of PDF
files:
<font size=4
color=blue>Plot Sine and Cosine Wave Without JavaScript</font> <br>
<loop id=x min=0 max=360 increment=5>
<Store id=sin value="{x}:{eval(Math.sin({x.radian}) * 100 + 100)}">
<Store id=cos value="{x}:{eval(Math.cos({x.radian}) * 100 + 100)}">
</loop>
<graphic border=0 height=260 width=400 range="0,0,100,200">
Graph Black,1,solid,0.97,0,0,200,360,Black,12,,0,360,8,
4,Black,1,solid,0,true,-1,1,10,4,Black,1,solid,2,true;
Line Blue,4,,0,{sin.join};
Line Red,4,,0,{cos.join};
</graphic>
Monthly
Calendar with events
<font size=5
Color=Blue>Monthly Calendar Example</font><br>
<calendar year=2010 width=500 height=500 border=3 Month=Dec>
<event day=6 style="Background-Color:yellow">
<font size=3 >Saint
Nicholas</font>
</event>
<event day=25 border=2 style="Background-Color:yellow">
<img src=c.jpg><font size=3>xmax</font>
</event>
</calendar>
Time Line
<timeline Height=100 Width=500
Start="Jan 1, 2010" Duration="1 Year" Resolution=day eventMaxLevels=3
eventFontColor=black eventFontSize=8 eventFontName=Arial eventAlign=center
eventPlacement=updown eventHeight=20 eventWidth=60 eventBorder=0
EventMarkerShape=box EventMarkerColor=blue EventMarkerSize=8
leaderSlant=0 leaderWidth=1 leaderColor=black leaderStyle=solid
LeaderType=box
baselineWidth=1 baselineLabels=Month baselineTics=0 baselineFontSize=6
baselineFontColor=black eventColor=Yellow>
<event date="Dec 25, 2010">Christmas</event>
<event date="Jan 1, 2010">New Years</event>
<event date="July 4, 2010" color=red>4th of July</event>
<event date="Nov 23, 2010">Thansgiving</event>
<event date="Feb 2, 2010">Groundhog Day</event>
<event date="Feb 14, 2010">Valentine's Day</event>
<event date="Feb 14, 2010">Chinese New Year</event>
<event date="Mar 17, 2010">Patrick's Day</event>
</timeline>
Run from Client or
ASP Server
Cascade Style Sheets
Margins, Padding,
Borders
Vertical and
horizontal alignments
Tables
Relative and
Absolute positioning
Images (Jpeg only)
tags supported: <A><CENTER><LI><OL><UL><DIV><SPAN><FONT><IMG><TABLE><TR><TD><TFOOT><THEAD> <BR><P><SUP><SUB><B><U><I><H1><H2><H3><H4><H5><H6><HR> <BLOCKQUOTE>
Client Side - Minimum Code:
<html><head> <script src="collinsPdf.js" language="javascript"></script> <script src="collinsHtml.js" language="javascript"></script> <script>
function createPdf()
{
html = new html$()
pdf =
new pdf$();
html.parse("<B> Hello World</B>");
html.writeToPdf(pdf);
pdf.writeToFile('c:/temp/hello_world.pdf');
window.open('file://c:/temp/hello_world.pdf');
}
</script>
</head><body>
<input type=button value="Create Pdf file" onClick=createPdf()>
</body></html>
Server Side - Minimum ASP Code:
<%@ language=javascript%> <script SRC="collinsPdf.js" language="JavaScript" runat="Server"></script> <script SRC="collinsHtml.js" language="JavaScript" runat="Server"></script> <% html = new html$();
pdf =
new pdf$();
html.parse("The Date is: <b><i>" + new Date() + "</i></B>");
html.writeToPdf(pdf);
pdf.sendToClient('sample_asp.pdf'); %>