Link in 'message' of pdfHtml5 button

Link in 'message' of pdfHtml5 button

CapamaniaCapamania Posts: 229Questions: 79Answers: 5
edited January 2017 in Buttons

I would like to place a link in the text of 'message' within a pdfHtml5 button.

            {
                extend:    'pdfHtml5',
                text:      'PDF',
                titleAttr: 'PDF',
                title: 'My title',
                header: true,
                message: 'And I would like to have a link <a href="www.google.com">here</a>. Many thanks. ',
                customize: function(doc) {                      
                    doc.defaultStyle.fontSize = 6;
                                        doc.styles.title.margin = [0, 20, 0, 12];
                }   
            }

I suppose I need a function for 'message'?! ... but how do I do this? https://datatables.net/reference/button/pdfHtml5

And trying to set the titles margin with doc.styles.title.margin = [0, 20, 0, 12]; does not trigger? Why so?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    You can't just use HTML in the PDF I'm afraid. You'd need to have a read at the pdfmake documentation to see how links are constructed with their API.

    You can then use the customize callback to modify the document to your needs.

    Allan

  • CapamaniaCapamania Posts: 229Questions: 79Answers: 5

    No problem. What works e.g. is if I splice the 'message' with e.g.

    customize: function(doc) {
          doc.content.splice(1, 1, 
                {
            columns: [
                { 
                text:"www.google.com", link:"https://www.google.com", decoration:"underline", color: 'blue'
                }
             ], 
                     fontSize: 7                                                
    }
    

    I get the blue and the underline ... but not the link. It's inactive. Any ideas why? Normally this is working. Thanks

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Answer ✓

    Not a clue I'm afraid. That would be one for the pdfmake support channels.

    Allan

  • CapamaniaCapamania Posts: 229Questions: 79Answers: 5

    No problem. I'll check with them. Regards

This discussion has been closed.