using jspdf.. html form is generating pdf file when button is click. I would like to Send an email instead of generating the file. when the button is clicked I would like the file to be email.
This is the pdf generating function
(function($){
var opts;
$.fn.UNUGeneratePDF = function(options){
// generate the pdf
if( options == 'Submit'){
generatePDF(this);
}
// initialization
else{
opts = $.extend( true, $.fn.UNUGeneratePDF.defaults, options );
initialize( this );
}
return this;
};
function generatePDF(e){
jspdf = new jsPDF();
jspdf.setProperties(opts.metadata);
if( opts.image64 ){
jspdf.addImage( opts.image64, 'PNG', 80, 15, 60, 18);
opts.layout.initY = 50;
}
var doc = new Document("", $.extend( {}, opts.layout, {jspdf:jspdf } ) );
var allPanels = $(e).find( "> .panel-group > .panel-default");
parse(doc, $(allPanels) );
if(opts.statement){
var statemt = new Section(" ");
var content = opts.statement.content;
statemt.add( new Input( content, "" ) );
var fields = new Section("");
$.each( opts.statement.fields, function(){
fields.add( new Input( this, " ") );
});
statemt.add(fields);
doc.add(statemt);
}
doc.render(0);
jspdf.save(opts.outputFileName + ".pdf");
}
calling the function in html\
<script>
(function($){
$("#historyApplicationForm").UNUGeneratePDF();
$("#pdfGenerate").on('click', function(event){
$("#historyApplicationForm").UNUGeneratePDF('Submit');
event.preventDefault();
});
})(jQuery);
</script>
Please anyone help me..