function emailpdf(){ var html2pdf = require('com.factisresearch.html2pdf'); Ti.API.info("module is => " + html2pdf); html2pdf.addEventListener('pdfready', function(e) { var emailDialog = Ti.UI.createEmailDialog(); var file = Ti.Filesystem.getFile(e.pdf); var newfile = file.rename('proposal.pdf'); //emailDialog.addAttachment(Ti.Filesystem.getFile(e.pdf)); //emailDialog.open(); file.rename('proposal.pdf'); var url = '../Documents/proposal.pdf'; var newurl = Ti.Filesystem.getFile(url); emailDialog.addAttachment(newurl); emailDialog.open(); Alloy.Globals.Log("opening viewpdf(url) on "+url); viewpdf(url); }); var html = '<html><body><p>Hello World Deen!</p></body></html>'; //var strVar=""; //strVar += "<html><body onload=init()><div id=\"top-bar\"><div id=\"doc-title\"><span class=\"name\">sample proposal : Sheet1<\/span><\/div><\/div><div id=\"sheets-viewport\"><div id=\"0\" style=\"display:none;position:relative;\" dir=\"ltr\"><div class=\"ritz grid-container\" dir=\"ltr\"><table class=\"waffle\" cellspacing=\"0\" cellpadding=\"0\"><thead><tr><th class=\"row-header freezebar-origin-ltr header-shim row-header-shim\"><\/th><th id=\"0C0\" style=\"width:195px\" class=\"header-shim\"><\/th><th id=\"0C1\" style=\"width:286px\" class=\"header-shim\"><\/th><th id=\"0C2\" style=\"width:100px\" class=\"header-shim\"><\/th><th id=\"0C3\" style=\"width:100px\" class=\"header-shim\"><\/th><th id=\"0C4\" style=\"width:100px\" class=\"header-shim\"><\/th><\/tr><\/thead><tbody><tr style='height:20px;'><th id=\"0R0\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">1<\/div><\/th><td><\/td><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr style='height:20px;'><th id=\"0R1\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">2<\/div><\/th><td class=\"s0\" dir=\"ltr\" colspan=\"5\">DbayCo Inc. 130 Moreland Rd., Brookfield, WI 53222<\/td><\/tr><tr style='height:20px;'><th id=\"0R2\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">3<\/div><\/th><td class=\"s1\" dir=\"ltr\" colspan=\"5\">Phone: 262-501-2948, Fax: 262-290-3141. Email: deen@idevice.net<\/td><\/tr><tr style='height:20px;'><th id=\"0R3\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">4<\/div><\/th><td class=\"s2\" colspan=\"5\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R4\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">5<\/div><\/th><td class=\"s3\" dir=\"ltr\" colspan=\"3\">proposal<\/td><td class=\"s0\" dir=\"ltr\" colspan=\"2\">WAN-20150225-1<\/td><\/tr><tr style='height:20px;'><th id=\"0R5\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">6<\/div><\/th><td class=\"s2\" colspan=\"2\" rowspan=\"2\"><\/td><td class=\"s2\" colspan=\"3\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R6\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">7<\/div><\/th><td class=\"s4\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R7\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">8<\/div><\/th><td class=\"s2\" dir=\"ltr\">Wannoorbaya WChik<\/td><td class=\"s2\" rowspan=\"4\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\">230<\/td><td class=\"s5\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R8\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">9<\/div><\/th><td class=\"s2\" dir=\"ltr\">2258 S Sanctuary Dr<\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s6\" dir=\"ltr\">due 4\/1\/2015<\/td><\/tr><tr style='height:20px;'><th id=\"0R9\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">10<\/div><\/th><td class=\"s2\" dir=\"ltr\">New Berlin, WI 53151<\/td><td class=\"s2\" colspan=\"3\" rowspan=\"2\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R10\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">11<\/div><\/th><td class=\"s2\" dir=\"ltr\">Date: 2\/28\/2014<\/td><\/tr><tr style='height:20px;'><th id=\"0R11\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">12<\/div><\/th><td class=\"s2\" colspan=\"5\" rowspan=\"2\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R12\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">13<\/div><\/th><\/tr><tr style='height:20px;'><th id=\"0R13\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">14<\/div><\/th><td class=\"s7\" dir=\"ltr\">Item no.<\/td><td class=\"s7\" dir=\"ltr\">Description<\/td><td class=\"s7\" dir=\"ltr\">Qty<\/td><td class=\"s7\" dir=\"ltr\">Unit\/Price<\/td><td class=\"s8\" dir=\"ltr\">Price<\/td><\/tr><tr style='height:20px;'><th id=\"0R14\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">15<\/div><\/th><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R15\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">16<\/div><\/th><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s2\" dir=\"ltr\">Mow Lawn<\/td><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s9\" dir=\"ltr\">100<\/td><td class=\"s10\" dir=\"ltr\">100<\/td><\/tr><tr style='height:20px;'><th id=\"0R16\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">17<\/div><\/th><td class=\"s9\" dir=\"ltr\">2<\/td><td class=\"s2\" dir=\"ltr\">Cut Trees<\/td><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s9\" dir=\"ltr\">120<\/td><td class=\"s10\" dir=\"ltr\">120<\/td><\/tr><tr style='height:20px;'><th id=\"0R17\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">18<\/div><\/th><td class=\"s11\"><\/td><td class=\"s11\"><\/td><td class=\"s11\"><\/td><td class=\"s11\" dir=\"ltr\"><\/td><td class=\"s12\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R18\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">19<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">SubTotal<\/td><td class=\"s10\" dir=\"ltr\">220<\/td><\/tr><tr style='height:20px;'><th id=\"0R19\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">20<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Tax<\/td><td class=\"s10\" dir=\"ltr\">10<\/td><\/tr><tr style='height:20px;'><th id=\"0R20\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">21<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Other<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R21\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">22<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Discount<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R22\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">23<\/div><\/th><td><\/td><td><\/td><td class=\"s13\" dir=\"ltr\"><\/td><td class=\"s13\" dir=\"ltr\">Paid<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R23\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">24<\/div><\/th><td><\/td><td><\/td><td class=\"s14\" dir=\"ltr\">Total due by<\/td><td class=\"s15\" dir=\"ltr\">4\/1\/2015<\/td><td class=\"s15\" dir=\"ltr\">230<\/td><\/tr><\/tbody><\/table><\/div><\/div><\/div></html>"; html2pdf.setHtmlString(html); }
button.addEventListener('click', function(e) { html2pdf.setHtmlString(html); });
// open a single window var win = Ti.UI.createWindow({ backgroundColor:'white' }); var button = Ti.UI.createButton({ title:'Gen/attach PDF', height:'auto', width:'auto' }); win.add(button); // TODO: write your module tests here var html2pdf = require('com.factisresearch.html2pdf'); Ti.API.info("module is => " + html2pdf); html2pdf.addEventListener('pdfready', function(e) { var pdfFile = Ti.Filesystem.getFile(e.pdf); var emailDialog = Ti.UI.createEmailDialog(); emailDialog.addAttachment(pdfFile); emailDialog.open(); }); button.addEventListener('click', function(e) { html2pdf.setHtmlString(html); }); win.open();
function emailpdf(){ var html2pdf = require('com.factisresearch.html2pdf'); Ti.API.info("module is => " + html2pdf); html2pdf.addEventListener('pdfready', function(e) { var emailDialog = Ti.UI.createEmailDialog(); var file = Ti.Filesystem.getFile(e.pdf); var newfile = file.rename('invoice.pdf'); //emailDialog.addAttachment(Ti.Filesystem.getFile(e.pdf)); //emailDialog.open(); file.rename('invoice.pdf'); var url = '../Documents/invoice.pdf'; //var url = '../Documents/Expose.pdf'; var newurl = Ti.Filesystem.getFile(url); emailDialog.addAttachment(newurl); emailDialog.open(); }); //var html = '<html><body><p>dBayCo Inc. limited </p></body></html>'; //var html=""; //html += "<html><body><div id=\"top-bar\"><div id=\"doc-title\"><span class=\"name\">sample invoice : Sheet1<\/span><\/div><\/div><div id=\"sheets-viewport\"><div id=\"0\" style=\"display:none;position:relative;\" dir=\"ltr\"><div class=\"ritz grid-container\" dir=\"ltr\"><table class=\"waffle\" cellspacing=\"0\" cellpadding=\"0\"><thead><tr><th class=\"row-header freezebar-origin-ltr header-shim row-header-shim\"><\/th><th id=\"0C0\" style=\"width:195px\" class=\"header-shim\"><\/th><th id=\"0C1\" style=\"width:286px\" class=\"header-shim\"><\/th><th id=\"0C2\" style=\"width:100px\" class=\"header-shim\"><\/th><th id=\"0C3\" style=\"width:100px\" class=\"header-shim\"><\/th><th id=\"0C4\" style=\"width:100px\" class=\"header-shim\"><\/th><\/tr><\/thead><tbody><tr style='height:20px;'><th id=\"0R0\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">1<\/div><\/th><td><\/td><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr style='height:20px;'><th id=\"0R1\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">2<\/div><\/th><td class=\"s0\" dir=\"ltr\" colspan=\"5\">DbayCo Inc. 130 Moreland Rd., Brookfield, WI 53222<\/td><\/tr><tr style='height:20px;'><th id=\"0R2\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">3<\/div><\/th><td class=\"s1\" dir=\"ltr\" colspan=\"5\">Phone: 262-501-2948, Fax: 262-290-3141. Email: deen@idevice.net<\/td><\/tr><tr style='height:20px;'><th id=\"0R3\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">4<\/div><\/th><td class=\"s2\" colspan=\"5\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R4\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">5<\/div><\/th><td class=\"s3\" dir=\"ltr\" colspan=\"3\">INVOICE<\/td><td class=\"s0\" dir=\"ltr\" colspan=\"2\">WAN-20150225-1<\/td><\/tr><tr style='height:20px;'><th id=\"0R5\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">6<\/div><\/th><td class=\"s2\" colspan=\"2\" rowspan=\"2\"><\/td><td class=\"s2\" colspan=\"3\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R6\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">7<\/div><\/th><td class=\"s4\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R7\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">8<\/div><\/th><td class=\"s2\" dir=\"ltr\">Wannoorbaya WChik<\/td><td class=\"s2\" rowspan=\"4\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\">230<\/td><td class=\"s5\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R8\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">9<\/div><\/th><td class=\"s2\" dir=\"ltr\">2258 S Sanctuary Dr<\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s5\" dir=\"ltr\"><\/td><td class=\"s6\" dir=\"ltr\">due 4\/1\/2015<\/td><\/tr><tr style='height:20px;'><th id=\"0R9\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">10<\/div><\/th><td class=\"s2\" dir=\"ltr\">New Berlin, WI 53151<\/td><td class=\"s2\" colspan=\"3\" rowspan=\"2\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R10\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">11<\/div><\/th><td class=\"s2\" dir=\"ltr\">Date: 2\/28\/2014<\/td><\/tr><tr style='height:20px;'><th id=\"0R11\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">12<\/div><\/th><td class=\"s2\" colspan=\"5\" rowspan=\"2\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R12\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">13<\/div><\/th><\/tr><tr style='height:20px;'><th id=\"0R13\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">14<\/div><\/th><td class=\"s7\" dir=\"ltr\">Item no.<\/td><td class=\"s7\" dir=\"ltr\">Description<\/td><td class=\"s7\" dir=\"ltr\">Qty<\/td><td class=\"s7\" dir=\"ltr\">Unit\/Price<\/td><td class=\"s8\" dir=\"ltr\">Price<\/td><\/tr><tr style='height:20px;'><th id=\"0R14\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">15<\/div><\/th><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><td class=\"s2\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R15\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">16<\/div><\/th><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s2\" dir=\"ltr\">Mow Lawn<\/td><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s9\" dir=\"ltr\">100<\/td><td class=\"s10\" dir=\"ltr\">100<\/td><\/tr><tr style='height:20px;'><th id=\"0R16\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">17<\/div><\/th><td class=\"s9\" dir=\"ltr\">2<\/td><td class=\"s2\" dir=\"ltr\">Cut Trees<\/td><td class=\"s9\" dir=\"ltr\">1<\/td><td class=\"s9\" dir=\"ltr\">120<\/td><td class=\"s10\" dir=\"ltr\">120<\/td><\/tr><tr style='height:20px;'><th id=\"0R17\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">18<\/div><\/th><td class=\"s11\"><\/td><td class=\"s11\"><\/td><td class=\"s11\"><\/td><td class=\"s11\" dir=\"ltr\"><\/td><td class=\"s12\" dir=\"ltr\"><\/td><\/tr><tr style='height:20px;'><th id=\"0R18\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">19<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">SubTotal<\/td><td class=\"s10\" dir=\"ltr\">220<\/td><\/tr><tr style='height:20px;'><th id=\"0R19\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">20<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Tax<\/td><td class=\"s10\" dir=\"ltr\">10<\/td><\/tr><tr style='height:20px;'><th id=\"0R20\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">21<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Other<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R21\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">22<\/div><\/th><td><\/td><td><\/td><td class=\"s13\"><\/td><td class=\"s13\" dir=\"ltr\">Discount<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R22\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">23<\/div><\/th><td><\/td><td><\/td><td class=\"s13\" dir=\"ltr\"><\/td><td class=\"s13\" dir=\"ltr\">Paid<\/td><td class=\"s10\" dir=\"ltr\">0<\/td><\/tr><tr style='height:20px;'><th id=\"0R23\" style=\"height: 20px;\" class=\"row-headers-background row-header-shim\"><div class=\"row-header-wrapper\" style=\"line-height: 20px;\">24<\/div><\/th><td><\/td><td><\/td><td class=\"s14\" dir=\"ltr\">Total due by<\/td><td class=\"s15\" dir=\"ltr\">4\/1\/2015<\/td><td class=\"s15\" dir=\"ltr\">230<\/td><\/tr><\/tbody><\/table><\/div><\/div><\/div><\/body><\/html>"; var coName = 'Jack Mow Inc.'; var coAddress = "1125 Bluemound Rd., Brookfield, WI 53222"; var coPhone = "262-290-3141"; var coFax = "262-290-3142"; var coEmail = "*****@*****.**"; var invoiceno = "002345"; var strVar=""; strVar += "<html>"; strVar += " <head>"; strVar += " <meta charset=\"utf-8\">"; strVar += " <title>Invoice<\/title>"; strVar += "<style>"; strVar += " \/* reset *\/"; strVar += ""; strVar += "*"; strVar += "{"; strVar += " border: 0;"; strVar += " box-sizing: content-box;"; strVar += " color: inherit;"; strVar += " font-family: inherit;"; strVar += " font-size: inherit;"; strVar += " font-style: inherit;"; strVar += " font-weight: inherit;"; strVar += " line-height: inherit;"; strVar += " list-style: none;"; strVar += " margin: 0;"; strVar += " padding: 0;"; strVar += " text-decoration: none;"; strVar += " vertical-align: top;"; strVar += "}"; strVar += ""; strVar += "\/* content editable *\/"; strVar += ""; strVar += "*[contenteditable] { border-radius: 0.25em; min-width: 1em; outline: 0; }"; strVar += ""; strVar += "*[contenteditable] { cursor: pointer; }"; strVar += ""; strVar += "*[contenteditable]:hover, *[contenteditable]:focus, td:hover *[contenteditable], td:focus *[contenteditable], img.hover { background: #DEF; box-shadow: 0 0 1em 0.5em #DEF; }"; strVar += ""; strVar += "span[contenteditable] { display: inline-block; }"; strVar += ""; strVar += "\/* heading *\/"; strVar += ""; strVar += "h1 { font: bold 100% sans-serif; letter-spacing: 0.5em; text-align: center; text-transform: uppercase; }"; strVar += ""; strVar += "\/* table *\/"; strVar += ""; strVar += "table { font-size: 75%; table-layout: fixed; width: 100%; }"; strVar += "table { border-collapse: separate; border-spacing: 2px; }"; strVar += "th, td { border-width: 1px; padding: 0.5em; position: relative; text-align: left; }"; strVar += "th, td { border-radius: 0.25em; border-style: solid; }"; strVar += "th { background: #EEE; border-color: #BBB; }"; strVar += "td { border-color: #DDD; }"; strVar += ""; strVar += "\/* page *\/"; strVar += ""; strVar += "html { font: 16px\/1 'Open Sans', sans-serif; overflow: auto; padding: 0.5in; }"; strVar += "html { background: #999; cursor: default; }"; strVar += ""; strVar += "body { box-sizing: border-box; height: 11in; margin: 0 auto; overflow: hidden; padding: 0.5in; width: 8.5in; }"; strVar += "body { background: #FFF; border-radius: 1px; box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5); }"; strVar += ""; strVar += "\/* header *\/"; strVar += ""; strVar += "header { margin: 0 0 3em; }"; strVar += "header:after { clear: both; content: \"\"; display: table; }"; strVar += ""; strVar += "header h1 { background: #000; border-radius: 0.25em; color: #FFF; margin: 0 0 1em; padding: 0.5em 0; }"; strVar += "header address { float: left; font-size: 75%; font-style: normal; line-height: 1.25; margin: 0 1em 1em 0; }"; strVar += "header address p { margin: 0 0 0.25em; }"; strVar += "header span, header img { display: block; float: right; }"; strVar += "header span { margin: 0 0 1em 1em; max-height: 25%; max-width: 60%; position: relative; }"; strVar += "header img { max-height: 100%; max-width: 100%; }"; strVar += "header input { cursor: pointer; -ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\"; height: 100%; left: 0; opacity: 0; position: absolute; top: 0; width: 100%; }"; strVar += ""; strVar += "\/* article *\/"; strVar += ""; strVar += "article, article address, table.meta, table.inventory { margin: 0 0 3em; }"; strVar += "article:after { clear: both; content: \"\"; display: table; }"; strVar += "article h1 { clip: rect(0 0 0 0); position: absolute; }"; strVar += ""; strVar += "article address { float: left; font-size: 125%; font-weight: bold; }"; strVar += ""; strVar += "\/* table meta & balance *\/"; strVar += ""; strVar += "table.meta, table.balance { float: right; width: 36%; }"; strVar += "table.meta:after, table.balance:after { clear: both; content: \"\"; display: table; }"; strVar += ""; strVar += "\/* table meta *\/"; strVar += ""; strVar += "table.meta th { width: 40%; }"; strVar += "table.meta td { width: 60%; }"; strVar += ""; strVar += "\/* table items *\/"; strVar += ""; strVar += "table.inventory { clear: both; width: 100%; }"; strVar += "table.inventory th { font-weight: bold; text-align: center; }"; strVar += ""; strVar += "table.inventory td:nth-child(1) { width: 26%; }"; strVar += "table.inventory td:nth-child(2) { width: 38%; }"; strVar += "table.inventory td:nth-child(3) { text-align: right; width: 12%; }"; strVar += "table.inventory td:nth-child(4) { text-align: right; width: 12%; }"; strVar += "table.inventory td:nth-child(5) { text-align: right; width: 12%; }"; strVar += ""; strVar += "\/* table balance *\/"; strVar += ""; strVar += "table.balance th, table.balance td { width: 50%; }"; strVar += "table.balance td { text-align: right; }"; strVar += ""; strVar += "\/* aside *\/"; strVar += ""; strVar += "aside h1 { border: none; border-width: 0 0 1px; margin: 0 0 1em; }"; strVar += "aside h1 { border-color: #999; border-bottom-style: solid; }"; strVar += ""; strVar += ""; strVar += "@media print {"; strVar += " * { -webkit-print-color-adjust: exact; }"; strVar += " html { background: none; padding: 0; }"; strVar += " body { box-shadow: none; margin: 0; }"; strVar += " span:empty { display: none; }"; strVar += " .add, .cut { display: none; }"; strVar += "}"; strVar += ""; strVar += "@page { margin: 0; }"; strVar += " <\/style>"; strVar += " <\/head>"; strVar += " <body>"; strVar += " <header>"; strVar += " <h1>Invoice<\/h1>"; strVar += " <address contenteditable>"; strVar += " <p>"+coName+"<\/p>"; strVar += " <p>"+coAddress+"<\/p>"; strVar += " <p>"+coPhone+"<\/p>"; strVar += " <p>"+coFax+"<\/p>"; strVar += " <p>"+coEmail+"<\/p>"; strVar += " <\/address>"; strVar += " <span><img alt=\"\" src=\"logo.png\"><input type=\"file\" accept=\"image\/*\"><\/span>"; strVar += " <\/header>"; strVar += " <article>"; strVar += " <h1>Recipient<\/h1>"; strVar += " <address contenteditable>"; strVar += " <p>Some Company<br>c\/o Some Guy<br>c\/o Some Guy<br>c\/o Some Guy<br>c\/o Some Guy<\/p>"; strVar += " <\/address>"; strVar += " <table class=\"meta\">"; strVar += " <tr>"; strVar += " <th><span contenteditable>Invoice #<\/span><\/th>"; strVar += " <td><span contenteditable>"+invoiceno+"<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <tr>"; strVar += " <th><span contenteditable>Date<\/span><\/th>"; strVar += " <td><span contenteditable>January 1, 2012<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <tr>"; strVar += " <th><span contenteditable>Amount Due<\/span><\/th>"; strVar += " <td><span id=\"prefix\" contenteditable>$<\/span><span>600.00<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <\/table>"; strVar += " <table class=\"inventory\">"; strVar += " <thead>"; strVar += " <tr>"; strVar += " <th><span contenteditable>Item<\/span><\/th>"; strVar += " <th><span contenteditable>Description<\/span><\/th>"; strVar += " <th><span contenteditable>Rate<\/span><\/th>"; strVar += " <th><span contenteditable>Quantity<\/span><\/th>"; strVar += " <th><span contenteditable>Price<\/span><\/th>"; strVar += " <\/tr>"; strVar += " <\/thead>"; strVar += " <tbody>"; strVar += " <tr>"; strVar += " <td><a class=\"cut\">-<\/a><span contenteditable>Front End Consultation<\/span><\/td>"; strVar += " <td><span contenteditable>Experience Review<\/span><\/td>"; strVar += " <td><span data-prefix>$<\/span><span contenteditable>150.00<\/span><\/td>"; strVar += " <td><span contenteditable>4<\/span><\/td>"; strVar += " <td><span data-prefix>$<\/span><span>600.00<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <\/tbody>"; strVar += " <\/table>"; strVar += " <table class=\"balance\">"; strVar += " <tr>"; strVar += " <th><span contenteditable>Total<\/span><\/th>"; strVar += " <td><span data-prefix>$<\/span><span>600.00<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <tr>"; strVar += " <th><span contenteditable>Amount Paid<\/span><\/th>"; strVar += " <td><span data-prefix>$<\/span><span contenteditable>0.00<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <tr>"; strVar += " <th><span contenteditable>Balance Due<\/span><\/th>"; strVar += " <td><span data-prefix>$<\/span><span>600.00<\/span><\/td>"; strVar += " <\/tr>"; strVar += " <\/table>"; strVar += " <\/article>"; strVar += " <aside>"; strVar += " <h1><span contenteditable>Additional Notes<\/span><\/h1>"; strVar += " <div contenteditable>"; strVar += " <p>A finance charge of 1.5% will be made on unpaid balances after 30 days.<\/p>"; strVar += " <\/div>"; strVar += " <\/aside>"; strVar += " <\/body>"; strVar += "<\/html>"; html2pdf.setHtmlString(strVar); }