0

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..

ifu
  • 11
  • 3
  • 2
    Did you search this site for an answer first? This has been asked and answered multiple times. – Brett May 26 '15 at 19:10
  • The problem is how to call the jQuery output file(pdf) to php in order send an email.. – ifu May 27 '15 at 11:09
  • I assume you saved the PDF file somewhere when you created it, right? All you need to do is tell your mailing application in PHP where the file is located and attach it to the email. – Brett May 27 '15 at 15:06

0 Answers0