pdf export - cannot customise column widths AND add message

pdf export - cannot customise column widths AND add message

crush123crush123 Posts: 417Questions: 126Answers: 18
edited June 2016 in Buttons

I have set up a pdfHtml5 export and I can either set the column widths OR add a message.

If I try to add both, I get an error Cannot set property 'widths' of undefined

{
            extend: 'pdf',
            message: 'hello',
            text: 'PDF',
            pageSize: 'A4',
            download: 'open',
            orientation: 'landscape',
            exportOptions: {
                columns: [1,2,4,5,6,7,8]
            },
            customize : function(doc) { 
                doc.content[1].table.widths = [ '10%', '12%', '12%', '18%', '28%', '10%', '10%'];
            }
        }

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Answer ✓

    If you add a message the doc.content array is altered. You could console.log( doc.content ) in your customize method, but I think you'll find that the table is bumped into doc.contant[2].

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited June 2016

    Perfect. - I got the code snippet from another post.

    I understand it now

This discussion has been closed.