Format exported pdf file as its text is overwriting on each other

Format exported pdf file as its text is overwriting on each other

mrumarasgharmrumarasghar Posts: 12Questions: 4Answers: 1

Hi, I am using datatables to PDF export option but when I export it with too much it overwrites the data. The data comes above each other and look very akward and distorted.

Here is an image of the example. Please look at it.

[

](

"

")

I want to fix that issue ( data above on each other ). Can we get it fixed by styling the pdf file?

This question has an accepted answers - jump to answer

Answers

  • mrumarasgharmrumarasghar Posts: 12Questions: 4Answers: 1

    I tried to embed the image in the last post but it was not embedded successfully so I am going to share its link so that you could see that example.

    Here is the example image with the related issue. The overflowing text is highlighted in red.

    http://imgur.com/a/Gp1aq

  • mrumarasgharmrumarasghar Posts: 12Questions: 4Answers: 1

    I have written this code to adjust any no of columns on the pdf. But there is one issue left which is about that data overwriting ( data above on each other ). The code for adjusting any number of column is that

                         customize : function(doc){
                                var colCount = new Array();
                                var length = $('#reports_show tbody tr:first-child td').length;
                                $('#reports_show').find('tbody tr:first-child td').each(function(){
                                    if($(this).attr('colspan')){
                                        for(var i=1;i<=$(this).attr('colspan');$i++){
                                            colCount.push('*');
                                        }
                                    }else{ colCount.push(parseFloat(100 / length)+'%'); }
                                });
                                doc.content[2].table.widths = colCount;
    
                            },
    

    But can you please introduce me with an option that would allow us to avoid overwritten of text ( data above on each other ). Can't we put some styling like CSS in which we use to break the word and come to the next line. Like in css we use word-wrap: break-all or else. Can't we use such option in PDF styling?

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    Answer ✓

    This is a limitation and error in the pdfmake library I'm afraid. It is not a DataTables issue and you would need to raise it in the pdfmake issues list.

    Allan

This discussion has been closed.