0

I am implementing the pdf generation via client side using jsPDF. I can download the pdf but when displaying on a second tab I have problems because it generates a very large base64 and the browser does not read. When the data is few the browser reads but it is necessary to press the enter key. Can anyone help me?

I tried to see some answers here but I did not succeed

My js code

gerarRelatorio=function() {

        var colunas = [ {title: "ID", dataKey: "idDistrito"},
            {title: "Nome", dataKey: "nome"},
            {title: "Código Dne", dataKey: "codigoDne"}, ]

        var linhas = $scope.distritos;

        var doc = new jsPDF('p', 'pt');

        doc.autoTable(colunas,  linhas, {
            styles: {fillColor: [230, 230, 230],  fontSize: 9},
            columnStyles: {
                id: {fillColor: [230, 230, 230], fontSize: 20},
            },

            margin: {top: 60},

            addPageContent: function(data) {
                 if ( $scope.distritos[0].entidade.brasao) {
                      doc.addImage($scope.distritos[0].entidade.brasao, 'JPEG', data.settings.margin.left, 12, 35, 40);

                  }
                doc.setFontSize(11);
                doc.text("ESTADO DO " + $scope.distritos[0].uf.nome + " " + $scope.distritos[0].entidade.nome, 90, 36 );    
                doc.text("Total de  " + $scope.distritos.length + " registros ", 455, 50 );
            }
        });

        doc.output('dataurlnewwindow');

i got this error :

enter image description here

Eduardo Krakhecke
  • 375
  • 2
  • 10
  • 22

0 Answers0