Doubt in a jquery with div print

Asked

Viewed 158 times

1

following doubt, I have a javascript code that it makes impression of a div by id, only the following, is a form, I would like to customize, with header and images, it is possible without I have to insert the data in the div?

There goes the script:

<script type = 'text/javascript'>
 $(document).ready(function(){
    //IMPRESSÃO - A O CONTEUDO QUE SERÁ IMPRESSO DEVERA ESTAR DENTRO DE UMA //DIV CHAMADA print
    $("#imprimir").click(function () {        
    $("#botoes").hide();       
    $("#print").show();
    window.print();         
    $("#botoes").show();       
});
EXPORTAR PARA PDF - O CONTEUDO DA EXPORTAÇÃO DEVERÁ ESTAR DENTRO DE UMA DIV CHAMADA PRINT
$("#pdf").click(function () {
      var pdf = new jsPDF('p','pt','letter');
        var specialElementHandlers = {
            '#print': function (element, renderer) {
            return true;
        }
    };
    pdf.addHTML($('#print').first(), function() {
        pdf.save("RelatorioPdf.pdf");
    });
});   
EXPORTAR EXCEL - O CONTEUDO DA EXPORTAÇÃO DEVERÁ ESTAR DENTRO DE UMA DIV CHAMADA PRINT
$("#excel").click(function () {
    var htmltable= document.getElementById('print');
    var html = htmltable.outerHTML;
    window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));
});

});

Is there another question taking advantage, as I apply UTF-8 in this export? Dumb doubt I know, but I’m just a new padawan in this area of development. Thanks and thanks for helping.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.