Collins Software
Software Developer
713-682-1556
ICMap Cg2 JavaScript PHP ETerms Mav Contact Links Videos

DOWNLOAD

CollinsPDF
CollinsHTML
Collins3D
CollinsPARSE
CollinsCOMPILER
CollinsLANGUAGE

CollinsPDF GUIDE
CollinsHTML GUIDE

Math Tags
Report Tags
Graphic Tags
Macro Tags
Misc Tags
Character Set
FAQ

CollinsPDF.js & CollinsPDF.php

Free 100% JavaScript Object, Client or Server side PDF creation
A JavaScript Report Generator / PDF file creation object. Create PDF reports at the server or client side without the need for any extra software or libraries. The CollinsPDF.js handles many of the standard reporting functions (group header/footers, keep together, cell alignment), to produce an excellent Report with minimum coding.

Html to PDF Online Example

Use the CollinsHTML JavaScript to handle your more complex reporting and formatting requirements

Capabilities:

  • Compatible to Adobe® Reader® Version 7 up
  • Pagination
  • NEW HTML5 Canvas to PDF (client side)
  • NEW Base64/Hex/Ascii85 String Image to PDF for IPhone, Android and BlackBerry Development
  • NEW Character Encoding Latin, Japanese, Chinese, Korean, Unicode
  • NEW PHP Object, identical code now in PHP language for those running Apache
  • Portrait or Landscape
  • 3D Images (include .U3D and .PRC formatted 3D files)
  • Any Paper Size (Letter, Legal, C, D, E,...) adjustable per page
  • Word wrap
  • Font Name, Color, Size, Bold, Italic, Underline, Subscript, and Superscript
  • Text Displays, Render, Scale, Letter/Word Spacing, Skew
  • Page Margins
  • Bookmarks (multiple levels)
  • Page Header and Footer
  • Add JavaScript to PDF document / page / form element events (example)
  • User Editable PDF Forms with updates sent to server or emailed (example)
  • Reporting (groups, group headers, group footers, keep together, details)
  • Rulers (columns, word wrap, truncate, justifications, borders, vertical alignment)
  • Graphics (Lines, Rectangles, Polygons, Circles, Cones, Text, Callout, Symbols, Grid, Arcs, Pie Chart, Graphs)
  • Hex Encoded Images (Hex and ASCII85 formats to produce 100% ASCII Pdf files)
  • Graphic Line Styles, Line Color, Fill Color
  • Symbols
  • Text Boxes
  • Watermarks
  • Hyperlinks
  • Run at Client or Server (ASP, .NET  or PHP)
  • Use with VBScript
  • Jpeg URL Images (add images as from a URL address, such as Google-maps)
  • Write to File, Send to Client, Send to Server, toString, toBase64, toUrlData

Client Side Creation of PDF (HTML5 only) Example
<script src="CollinsPdf.js" language="JavaScript"></script>

pdf = new pdf$();
pdf.addText("hello world");
window.location.href = pdf.toDataURL();

Client Side (IE with security restrictions)

<html><head>
<script src="CollinsPdf.js" language="JavaScript"></script>
<script>
function createPdf()
{
    pdf = pdf$();
    pdf.addText('Hello World');
    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>



Client Side (any browser, send content to server to be echoed back as a PDF file)

pdf = new pdf$();
pdf.addText("Hello World");
pdf.open('Echo.pdf');


Server Side - Minimum ASP Code: PDF Example

<%@ language=JavaScript%>
<script SRC="CollinsPdf.js" language="JavaScript" runat="Server"></script> <%
pdf = new pdf$('SAMPLE'); pdf.addText('The date is: ' + new Date()); pdf.lineBreak(); pdf.addImage(Server.MapPath("../images/test.jpg")); pdf.sendToClient(''); %>

Server Side - Minimum PHP Code:  PDF Example

<?php
require('CollinsPDF.php');

$pdf = new pdf();
$pdf->addText('hello world');
$pdf->sendToClient();

?>


Google Maps PDF Example

var url,pdf;

url = "";
url += "http://maps.google.com/maps/api/staticmap?";
url += "center=Brooklyn+Bridge,New+York,NY&zoom=14";
url += "&size=512x512&maptype=roadmap";
url += "&markers=color:blue|label:S|40.702147,-74.015794";
url += "&markers=color:green|label:G|40.711614,-74.012318";
url += "&markers=color:red|color:red|label:C|40.718217,-73.998284";
url += "&format=jpg";
url += "&sensor=false&key=your-key-code"
pdf = new pdf$();
pdf.placeImage(2,2,url,5,0,0);

pdf.setFontSize(24);
pdf.setBold(true);
pdf.setItalic(true);
pdf.placeText(2,0.5,'Collins Software');
pdf.setFontSize(14);
pdf.placeText(2,1,'Googlemaps to PDF');
 

Adding Images as a Web URL
PDF Example

var url,pdf;

pdf = new pdf$();

url = 'http://CollinsSoftware.com/icmap/ic_ecp/bin/ICMapIS.cgi';
url += "?name=ecp&height=600&width=600";
url += "&x=-95.48151&y=29.79966";
url += "&level=3&layers=states&format=jpg";

pdf.placeImage(2,2,url,3,0,0);

pdf.setFontSize(24);
pdf.setBold(true);
pdf.setItalic(true);
pdf.placeText(2,0.5,'Collins Software');
pdf.setFontSize(14);
pdf.placeText(2,1,'Url Image to PDF');
 


Adding 3D Images to PDF File PDF Example
	
pdf = new pdf$();
pdf.addImage('sample_network.u3d',4,8);
pdf.sendToClient();


VBSCRIPT Server Side ASP Example, (using collinsPDF.js in VBSCRIPT)
Create an Invoice PDF Example

<script SRC="collinsPDF.js" language="JavaScript" RUNAT="Server"></script>
<%
Response.Expires = -1
call Execute()
'=========================================================================
'                         Execute
'=========================================================================
Function Execute()

dim pdf,filename,text
dim po,dateOrdered,shipTo,shipType,phone,billTotal,billTax,billShipping
dim borderWidth

set pdf = vb_pdf()

pdf.setMargin 1,1,2,1
pdf.setFontSize(12)
set pdf.onPageHeader = GetRef("onPageHeader")
set pdf.onPageFooter = GetRef("onPageFooter")

pdf.setBold(true)
pdf.addText "Thank you for your purchase "
pdf.setBold(false)

pdf.lineBreak
pdf.lineBreak

'------------------ order details --------------------

CR = Chr(13) & Chr(10)

orderNumber = "10034"
dateOrdered = "May 5, 2010 3:31 pm"
shipTo = "Rachel Collins" & CR & "7710 Janak Drive" & CR & "Houston, TX 77055"
shipMethod = "Next Day Air"
phone = "(713) 682-1556"
billAmount = "$300.00"
billTotal = "$357.56"
billTax = "$45.56"
billShipping = "$12.00"

call orderDetail(pdf,orderNumber,dateOrdered,shipTo,shipMethod,_
                 phone,billAmount,billTotal,billTax,billShipping)

pdf.ruler.end()
pdf.lineBreak
pdf.lineBreak

'--------------------Items Ordered ----------------------

pdf.pageBreak

borderWidth = 1
pdf.setRuler "1,1.6W,5.5W,7",borderWidth
pdf.setBold(true)
TEXT = "QTY" & pdf.tabCharacter & "Product Name" & pdf.tabCharacter & "Price"
pdf.reportAddText(text)
pdf.setBold(false)

' -------- Item 1 -----

item_qty = 1
item_name = "Common Groud 2000 CPU License"
item_total = "$100.00"

call orderItem(pdf,item_qty,item_name,item_total)


' -------- Item 2 -----

item_qty = 1
item_name = "ICMap CPU License"
item_total = "$200.00"

call orderItem(pdf,item_qty,item_name,item_total)

'--------------------------------------------------------

pdf.ruler.end()

text = "Thank you for the order"
pdf.setFontColor("Gray")
pdf.setFontSize(10)

pdf.centerText(text)

pdf.sendToClient

END Function
'================================================================
'                 onPageHeader
'================================================================
Function onPageHeader(page,total,pdf)

filename = Server.MapPath("./CollinsSoftwareInvoice.jpg")
pdf.placeImage 0.5,0.1,filename,1

End Function

'================================================================
'                 onPageFooter
'================================================================
Function onPageFooter(page,total,pdf)
dim text

text = "Page " & page & " of " & total
pdf.centerText(text)

End Function

'================================================================
'                 orderDetail
'================================================================
Function orderDetail(pdf,orderNumber,dateOrdered,shipTo,shipMethod,_
        phone,billAmount,billTotal,billTax,billShipping)
 

dim text

pdf.setRuler("1,3W,7")

TEXT = "Order Number:" & pdf.tabCharacter & orderNumber
pdf.reportAddText(text)

TEXT = "Order Date:" & pdf.tabCharacter & dateOrdered
pdf.reportAddText(text)

TEXT = "Ship to:" & pdf.tabCharacter & shipTo
pdf.reportAddText(text)

TEXT = "Phone:" & pdf.tabCharacter & phone
pdf.reportAddText(text)

TEXT = "Shipping Method:" & pdf.tabCharacter & shipMethod
pdf.reportAddText(text)

TEXT = "Order Amount:" & pdf.tabCharacter & billAmount
pdf.reportAddText(text)

TEXT = "Order State Tax (Texas):" & pdf.tabCharacter & billTax
pdf.reportAddText(text)

TEXT = "Order Shipping:" & pdf.tabCharacter & billShipping
pdf.reportAddText(text)

TEXT = "Order Total:" & pdf.tabCharacter & billTotal
pdf.reportAddText(text)

End Function
'================================================================
'                 orderItem
'================================================================
Function orderItem(pdf,item_qty,item_name,item_total)

dim text,name,cr

TEXT = item_qty & pdf.tabCharacter & item_name & pdf.tabCharacter & item_total
pdf.reportAddText(text)

END Function
%>


Copyright © 2012, Collins Software
Privacy