Totally Remove Title from Datatables pdfHtml5 Export

Totally Remove Title from Datatables pdfHtml5 Export

gentestnewgentestnew Posts: 8Questions: 1Answers: 0

Pleaes help

This question has an accepted answers - jump to answer

Answers

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    Totally Remove Title from Datatables Export especially in pdfHtml5 Export

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Answered several times before, e.g.
    https://datatables.net/forums/discussion/54065

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    Thank you very much tangerine
    But that thread has commented by colin says,

    colincolin Posts:
    January 2019 Answer ✓
    Hi @harshithg ,

    The title property is part of the excel button, not the collection, so you would declare it like this:

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    anyone please..

  • kthorngrenkthorngren Posts: 21,325Questions: 26Answers: 4,949

    Does this example help?

    Kevin

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    @kthorngren Thank you so much for look after my q,
    but it is still remaining. when I try to export pdf titles comes on top. i tried many ways.

    Please Help...

  • kthorngrenkthorngren Posts: 21,325Questions: 26Answers: 4,949
    edited February 2021 Answer ✓

    What did you try? The example points to the buttons.exportInfo() docs to explain how to use the parameters. For the title it states this:

    title - Shown at the very top of the exported document
    * (default) - Use the HTML page's title value.
    null - Do not show a title in the output
    string - Static string that should be used
    function - Resolve the function and use the returned value

    Did you set title to null? Here is an example:
    http://live.datatables.net/zasajeyu/1/edit

    Kevin

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    @kthorngren
    Thank you very much and that did very help me to understand the problem.

    and another small question.
    which is even title is not appearing there is empty page for title( have set A4 pages for each row contains images,)

    below is my code for extend,

      extend: 'pdfHtml5',
      stripHtml: false,
      header: false,
      messageBottom: null,
      messageTop: null,
      footer: false,
      orientation: 'portrait',
      pageSize: 'A4',
      customize: 
      function ( doc ) {
      if (doc) {
        doc.styles.title = {
                                color: '#4c8aa0',
                                fontSize: '50',
                                alignment: 'center',
                                display: 'none'
                            },        
      doc.pageMargins = [0,0,0,0];
                   for (var i = 1; i < doc.content[1].table.body.length; i++) {
                      doc.content[1].table.body[i][0] = {
                           image: '<?php echo $base64;  ?>', //this doesn't work, as only 1 image is shown in PDF
                           width: 595,
    
                       };
                   }
               }
    
           },
    

    Thank you very much Mr. Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    See this thread for having the title on every page,

    Colin

  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0
    edited February 2021

    @colin
    Thank you very much,
    but i want to remove title and whole title row, when i apply code below,
    along with extend
    title: null,
    code is not working or render out the pdf,

    Please help,

    function ( doc ) {
    if (doc) {
    doc.styles.title = {
    color: '#4c8aa0',
    fontSize: '50',
    alignment: 'center',
    display: 'none'
    },
    doc.pageMargins = [0,0,0,0];
    for (var i = 1; i < doc.content[1].table.body.length; i++) {
    doc.content[1].table.body[i][0] = {
    image: '<?php echo $base64; ?>', //this doesn't work, as only 1 image is shown in PDF
    width: 595,

                 };
             }
         }
    
  • gentestnewgentestnew Posts: 8Questions: 1Answers: 0

    just because of the above code export black A4 page for header title, i want remove it.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Could you update Kevin's test case, please, to have your most recent code - that way we're all looking at the same thing,

    Colin

This discussion has been closed.