DataTable export the pdf compressing the columns

DataTable export the pdf compressing the columns

allanguersoniallanguersoni Posts: 4Questions: 0Answers: 0
edited October 2013 in General
I'm doing a report where I have about 140 columns and several rows.
In the CSV DataTable export properly in PDF already compress it the columns to fit the A4, already tried to make it just decrease the text or even break to the next page, but without success.

someone could help me? ;)

[code]
$monitorTable = $('#table').dataTable( {

"bProcessing": true,
"iDisplayLength": 50,
"bPaginate": true,
"bScrollCollapse": true,
"sScrollY": 250,
"sScrollX": "100%",
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
// "aoColumnDefs":[
// { "sType":"title-numeric", "aTargets":[ 3 ] },
// { "sType":"title-numeric", "aTargets":[ 7 ] },
// { "bSortable":false, "aTargets":[ 0 ] },
// { "bSortable":false, "aTargets":[ 8 ] },
// { "bSortable":false, "aTargets":[ 9 ] },
// { "sClass":"center", "aTargets":[ 2, 3, 4, 5, 6, 7 ] }
// ],
//"aoColumns": [{ "sWidth": "5%" }, { "sWidth": "5%" }, { "sWidth": "5%" }, { "sWidth": "15%" }, { "sWidth": "10%" }],

"bServerSide": false,
//"sAjaxSource": 'ajax/arrays.txt',
"aaData": <?=json_encode($resultVolumes)?>,
"sDom": 'T<"clear">lfrtip',
"fnCalcColRatios": function ( oConfig )
{
var
aoCols = this.s.dt.aoColumns,
aColumnsInc = this._fnColumnTargets( oConfig.mColumns ),
aColWidths = [],
iWidth = 0, iTotal = 0, i, iLen;

for ( i=0, iLen=aColumnsInc.length ; i

Replies

  • arronleearronlee Posts: 3Questions: 0Answers: 0
    edited October 2013
    Using code to deal with PDFs is too complicated for me. Will some PDF processing tool help?
    http://www.yiigo.com/guides/csharp/how-to-process-pdf.shtml
  • allanguersoniallanguersoni Posts: 4Questions: 0Answers: 0
    Thanks for the tip, but the language I'm using is PHP, tried dompdf but still did not work.
    I wonder if someone already succeeded in printing PDF dataTable with more than 100 columns.
  • arronleearronlee Posts: 3Questions: 0Answers: 0
    You are welcome. I haven't noticed you were using PHP. But I am not so familiar with that. You can refer to some other forums to find a way out. I hope you success. Good luck.
  • allanguersoniallanguersoni Posts: 4Questions: 0Answers: 0
    The solution was to use another plugin called dompdf took a little work to understand more could customize my PDF with more than 100 columns .
    By dataTable I added a custom button .

    [code]

    . DTTT_container {
    border : 0px solid # 455 ;
    width: auto ;
    }
    . DTTT_button {
    margin- top: 7px ;
    border : 0px solid # 465 ;
    }
    . DTTT_button_link {
    width: 47px ;
    height: 32px ;
    display: block ;
    border : 0px solid # 444 ;
    background-color : transparent ;
    background-image : url ( ' img / back -button- pdf.png ' ) ;
    background-repeat : no-repeat ;
    background-position : center center ;
    float: left ;
    text-align : center;
    padding- top: 13px ;
    margin- top: - 1px ;
    cursor : pointer; cursor : hand ;
    }
    . DTTT_button_link : hover {
    width: 47px ;
    height: 32px ;
    display: block ;
    border : 0px solid # 444 ;
    background-color : transparent ;
    background-image : url ( ' img / button- back- pdf - hover.png ' ) ;
    background-repeat : no-repeat ;
    background-position : center center ;
    float: left ;
    text-align : center;
    padding- top: 13px ;
    margin- top: - 1px ;
    }




    TableTools.BUTTONS.gotoURL = {
    " sAction " : "text " ,
    " sFieldBoundary " : " " ,
    " sFieldSeperator " : " \ t " ,
    " sNewLine " : "
    "
    " sToolTip " : " " ,
    " sButtonClass ": " DTTT_button_link "
    " sButtonClassHover " : " " ,
    " sButtonText " : "Go to URL " , / / default , change When initiating
    " sGoToURL " : " " , / / default , change When initiating
    " mColumns " : "all" ,
    " bHeader " : true ,
    " bFooter " : true ,
    " fnMouseover " : null ,
    " fnMouseout " : null ,
    " fnClick " : function ( nButton , oConfig ) {
    / / location.href = oConfig.sGoToURL ;
    location.href = oConfig.sGoToURL ;
    / / alert ( oConfig.sGoToURL ) ;
    }
    " fnSelect " : null ,
    " fnComplete " : null ,
    " fnInit " : null
    } ;

    $ (document ) . ready (function ( ) {
    " oTableTools " : {
    " sSwfPath " : " swf / copy_csv_xls_pdf.swf "
    " aButtons " : [

    {
    " sExtends ": " gotoURL "
    " sButtonText " , " PDF " ,
    " sGoToURL " : " gerarPDF.php " , / / page in domPDF

    }
    "print "
    " csv "
    ] ........
    [/code ]
  • allanguersoniallanguersoni Posts: 4Questions: 0Answers: 0
    dompdf can not handle many values ​​valors for PDF creation, use mpdf that supports CSS and has many configuration options.
    Could treat my columns in a personalized way.
  • Nana111Nana111 Posts: 4Questions: 0Answers: 0
    HI there
    Here i got a code for Pdf:
    using System.IO;
    using System.Drawing.Printing;
    using RasterEdge.Imaging;
    using RasterEdge.Imaging.Codec.Compression;
    using RasterEdge.Imaging.PDF;

    DocumentCompression.infile(@"C:\1.pdf");
    DocumentCompression.Outfile(@"C:\2.pdf");
    DocumentEncoder = DocumentEncoder.Group3Encoding

    RasterEdgeImaging Document = new RasterEdgeDocumentg();
    Image. DocumentCompression(@"C:\1.pdf", "C:\2.pdf", DocumentEncoder DocumentEncoder.Group3Encoding);
    http://www.rasteredge.com/how-to/csharp-imaging/pdf-compressing/
    You can have a try.
This discussion has been closed.