< pre>tag problem when exporting PDF

< pre>tag problem when exporting PDF

albert_fredalbert_fred Posts: 5Questions: 2Answers: 0
edited June 2020 in Free community support

Hi there, when I export the dataTable to pdf, the < pre> tags that are inside the cells are not working. I put the pre tags in the render of the column.
Hope you have a solution,
Thanks!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • albert_fredalbert_fred Posts: 5Questions: 2Answers: 0

    Hi colin, thanks a lot for the quick answer.

    Sorry, I can not provide a test case, but I can be more detailed:

    I have a huge datable that two of it columns use a < pre > tag (in the tbody), in order to show the full sentence in one line. This are two full columns, so the idea I think it would have to. change the content of these columns...

    I use the pdf export option:
    buttons: [
    {
    extend: 'pdfHtml5',
    orientation: 'landscape',
    pageSize: 'A3',
    extension : '.pdf',
    text: '<i class="fa fa-file-pdf-o" aria-hidden="true"></i> PDF',
    className: 'btn-a3',
    header: true,
    footer: true,

                        pageMargins: [ 20, 60, 20, 60 ],
                        exportOptions: {
                            columns: ':visible',
                         }
                   },
    

    and in the customize function I give a little bit of style. Hope that with this info you can understand the problem.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Yep, we would need to see this. If you could create a very simple test case on http://live.datatables.net/ we'll take a look.

    Colin

  • albert_fredalbert_fred Posts: 5Questions: 2Answers: 0

    This is a short example

    http://live.datatables.net/pimofite/1/edit?html,css,js,output

    Wait for your answer! Thanks!

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Thanks for that test case. You can do something like this: http://live.datatables.net/pimofite/2/edit

    Here the code is fiddling with those <pre> tags, and replacing them with a \n,

    Colin

  • albert_fredalbert_fred Posts: 5Questions: 2Answers: 0

    Thanks!

This discussion has been closed.