I would like to know how can I export a HTML or website document to PDF.
The idea would be to have a buttom to click and convert the document.
I tried this but I get and error in var conv = new ActiveXObject(“pdfServMachine.converter”); –> “Element ActiveXObject is not defined”
[CODE]
<!DOCTYPE html>
<html>
<head>
<script type=”text/javascript”>
function init() {
var conv = new ActiveXObject(“pdfServMachine.converter”);
conv.convert(“http://www.google.com”, “c:\google.pdf”, false);
WScript.Echo(“finished conversion”);
}
</script>
</head>
<body>
Here is content of the site
<div id=”init”>
<button onclick=”init()”>Export to PDF</button>
</body>
</html>
Also tried this but not sure how to use the jspdf. Get an error in line: printDoc.fromHTML($(‘#pdf’).get(0), 10, 10, {‘width’: 180}); –> “$ is not defined”
[CODE]<!DOCTYPE html>
<html>
<head>
<title>html2canvas example</title>
<script type=”text/javascript” src=”js/jspdf.js”></script>
<script type=”text/javascript” src=”js/plugins/addimage.js”></script>
<script type=”text/javascript” src=”js/plugins/standard_fonts_metrics.js”></script>
<script type=”text/javascript” src=”js/plugins/split_text_to_size.js”></script>
<script type=”text/javascript” src=”js/plugins/from_html.js”></script>
<script type=”text/javascript”>
function printPDF() {
var printDoc = new jsPDF();
printDoc.fromHTML($(‘#pdf’).get(0), 10, 10, {‘width’: 180});
printDoc.autoPrint();
printDoc.output(“dataurlnewwindow”); // this opens a new popup, after this the PDF opens the print window view but there are browser inconsistencies with how
this is handled
}
var doc = new jsPDF();
var specialElementHandlers = {
‘#editor’: function (element, renderer) {
return true;
}
};
</script>
</head>
<body>
Content of the Site
<button onclick=”printPDF()”>Export to PDF</button>
</body>
</html>
THANK YOU SO MUCH