0

I can see CSV button and I'm able to download CSV, but I'm not able to see PDF button, can anyone help me with this?

extend: 'pdfHtml5',
text: 'PDF',
className: 'btn-sm invisible buttons-pdf',
exportOptions: { columns: ':visible' ,stripNewlines: false, trim : false},
title: this.criteria.get('name'),
orientation: 'landscape',
footer: true : false,
customize: function (doc) {
    console.log($colCount);
    console.log(doc);
    let colCount = $colCount;
    doc.styles.tableHeader.fontSize = 12;
    doc.defaultStyle.fontSize = 11;
    doc.styles.tableBodyEven.alignment = 'center';
    doc.styles.tableBodyOdd.alignment = 'center';
    doc.styles.tableFooter = {
        alignment: 'center',
        fillColor:"#2d4154",
        bold: true,
        fontSize: 12,
        color: "white"
    }
    doc.styles.tableBodyOdd.noWrap = true;
    doc.styles.tableBodyOdd.fillColor = '#f3f3f3';
    console.log(doc.content[1].table.body[($rowCount)+1]);
    _.each(doc.content[1].table.body[($rowCount)+1], function(col, key) {
        if(col.text != "") {
            var text  = col.text.split(/\r\n|\r|\n/g);
            col.text = text[1];
        }
    });

    for (i = 0; i <= $rowCount; i++) {
        doc.content[1].table.body[i][0].alignment = 'left';
    };

    var colWidth = [];
    var width;
    
    for (i = 0; i < colCount; i++) {
        width = 100 / colCount;
        colWidth.push(width + '%');
    }

    doc.content[1].table.widths = colWidth;
}

Do I need to import something while extending to pdfHtml5? Am I missing something?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • `className : 'invisible'` ? – Jeremy Thille Jan 18 '21 at 10:44
  • @JeremyThille i removed the class still facing the same issue . even after removing everything just using { text: 'PDF', extend: 'pdfHtml5', className: 'btn-sm buttons-pdf' } Still not able to see button – Aman Bisht Jan 18 '21 at 10:48
  • Does the button appear in the DOM? Does it just have a `display:none` or something? – Jeremy Thille Jan 18 '21 at 10:50
  • no i'm not able to see the button in DOM also. – Aman Bisht Jan 18 '21 at 10:51
  • Aaaaaah I just saw your tags, you have `jQuery` and `Angular` together....... Well, look no further, [here's your issue](https://stackoverflow.com/questions/51304288/what-is-the-right-way-to-use-jquery-in-react#:~:text=No.,deleting%20stuff%20into%2Ffrom%20them.). For some reason, everybody these days mix Angular and jQuery together... – Jeremy Thille Jan 18 '21 at 10:52
  • I needed to add "node_modules/pdfmake/build/pdfmake.min.js", "node_modules/pdfmake/build/vfs_fonts.js", in my angular json , please mark it as close – Aman Bisht Jan 18 '21 at 12:32

0 Answers0