jsPDF Attach PDF to mail












1















I have an HTML page with some input. When the customer clicks on Send button the below converted pdf has tobe sent in mail directly in php??Is it can be done?? If yes,how it can be done can someone help me in this flow



<script>
$('#print-btn').click(()=>{
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML($('#divName')[0],function() {
pdf.save('billing.pdf');
});
});
</script>









share|improve this question

























  • See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

    – Van Tho
    Nov 16 '18 at 9:12
















1















I have an HTML page with some input. When the customer clicks on Send button the below converted pdf has tobe sent in mail directly in php??Is it can be done?? If yes,how it can be done can someone help me in this flow



<script>
$('#print-btn').click(()=>{
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML($('#divName')[0],function() {
pdf.save('billing.pdf');
});
});
</script>









share|improve this question

























  • See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

    – Van Tho
    Nov 16 '18 at 9:12














1












1








1


1






I have an HTML page with some input. When the customer clicks on Send button the below converted pdf has tobe sent in mail directly in php??Is it can be done?? If yes,how it can be done can someone help me in this flow



<script>
$('#print-btn').click(()=>{
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML($('#divName')[0],function() {
pdf.save('billing.pdf');
});
});
</script>









share|improve this question
















I have an HTML page with some input. When the customer clicks on Send button the below converted pdf has tobe sent in mail directly in php??Is it can be done?? If yes,how it can be done can someone help me in this flow



<script>
$('#print-btn').click(()=>{
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML($('#divName')[0],function() {
pdf.save('billing.pdf');
});
});
</script>






javascript php codeigniter jspdf html2pdf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 8:05







user5370838

















asked Nov 16 '18 at 7:34









user5370838user5370838

4610




4610













  • See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

    – Van Tho
    Nov 16 '18 at 9:12



















  • See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

    – Van Tho
    Nov 16 '18 at 9:12

















See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

– Van Tho
Nov 16 '18 at 9:12





See this link, the pdf file will be upload into your server, then you just need to attach that pdf in your email.

– Van Tho
Nov 16 '18 at 9:12












1 Answer
1






active

oldest

votes


















0














As far as I know jsPDF only let you create a PDF on the client side of your application/website.



If you want to attach the generated PDF to an email you first have to pass the file created to a PHP script on your server side and then send the file like a normal attachment.



To pass the file you can encode your file in base64 and pass it as a string using AJAX to a PHP page where you will decode the data and generate the file with the content received.



After that you can attach it to an email and send it. The process here depends on what is your system of choiche for sending emails.



Another approach is to generate the file directly on the server side of your application/website so you can skip the js to php step.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333335%2fjspdf-attach-pdf-to-mail%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As far as I know jsPDF only let you create a PDF on the client side of your application/website.



    If you want to attach the generated PDF to an email you first have to pass the file created to a PHP script on your server side and then send the file like a normal attachment.



    To pass the file you can encode your file in base64 and pass it as a string using AJAX to a PHP page where you will decode the data and generate the file with the content received.



    After that you can attach it to an email and send it. The process here depends on what is your system of choiche for sending emails.



    Another approach is to generate the file directly on the server side of your application/website so you can skip the js to php step.






    share|improve this answer




























      0














      As far as I know jsPDF only let you create a PDF on the client side of your application/website.



      If you want to attach the generated PDF to an email you first have to pass the file created to a PHP script on your server side and then send the file like a normal attachment.



      To pass the file you can encode your file in base64 and pass it as a string using AJAX to a PHP page where you will decode the data and generate the file with the content received.



      After that you can attach it to an email and send it. The process here depends on what is your system of choiche for sending emails.



      Another approach is to generate the file directly on the server side of your application/website so you can skip the js to php step.






      share|improve this answer


























        0












        0








        0







        As far as I know jsPDF only let you create a PDF on the client side of your application/website.



        If you want to attach the generated PDF to an email you first have to pass the file created to a PHP script on your server side and then send the file like a normal attachment.



        To pass the file you can encode your file in base64 and pass it as a string using AJAX to a PHP page where you will decode the data and generate the file with the content received.



        After that you can attach it to an email and send it. The process here depends on what is your system of choiche for sending emails.



        Another approach is to generate the file directly on the server side of your application/website so you can skip the js to php step.






        share|improve this answer













        As far as I know jsPDF only let you create a PDF on the client side of your application/website.



        If you want to attach the generated PDF to an email you first have to pass the file created to a PHP script on your server side and then send the file like a normal attachment.



        To pass the file you can encode your file in base64 and pass it as a string using AJAX to a PHP page where you will decode the data and generate the file with the content received.



        After that you can attach it to an email and send it. The process here depends on what is your system of choiche for sending emails.



        Another approach is to generate the file directly on the server side of your application/website so you can skip the js to php step.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 9:10









        AndreaAndrea

        97313




        97313
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333335%2fjspdf-attach-pdf-to-mail%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python