How can we provide page border in pdf

How can we provide page border in pdf

nilakshibhosalenilakshibhosale Posts: 7Questions: 2Answers: 0
edited February 2019 in Free community support

how can i add page border, this is my code

$(document).ready(function() {
 $('#example').DataTable( {
"dom": 'Bfirtlp',
        buttons: [

                {
                extend: 'excelHtml5',
                exportOptions: {
                    columns: ':visible'
                }
                },
            {
                extend: 'pdfHtml5',
                exportOptions: {
                    columns: [ 0, 1, 2],
                },
            customize: function (doc) {
            var tblBody = doc.content[1].table.body;
                for(var i=0;i<tblBody[0].length;i++){
                  tblBody[0][i].fillColor = '#FFFFFF';
                  tblBody[0][i].color = 'black';
                }
            var now = new Date();
            var jsDate = now.toGMTString();
            doc['footer']=(function(page, pages) {
                            return [
                            {canvas: [ { type: 'line', x1: 30, y1: 15, x2: 595-30, y2: 15, lineWidth: 1,color:'black' } ]},
                            {
                            columns: [

                                     {
                                        alignment: 'left',
                                        fontSize:'7',
                                        text: ['Version: 1.0'],
                                    },
                                    {
                                        alignment: 'center',
                                        fontSize:'7',
                                        text: ['page ', { text: page.toString() }]
                                    },
                                    {
                                        alignment: 'right',
                                        fontSize:'7',
                                        text: ['Generated on: ', { text: jsDate}]
                                    },

                                ],
                                margin: [30,15,30,35]
                            },
                            ]
                        });

                        var objLayout = {};
                        objLayout['hLineWidth'] = function(i) { return .5; };
                        objLayout['vLineWidth'] = function(i) { return .5; };
                        objLayout['hLineColor'] = function(i) { return '#aaa'; };
                        objLayout['vLineColor'] = function(i) { return '#aaa'; };
                        objLayout['paddingLeft'] = function(i) { return 4; };
                        objLayout['paddingRight'] = function(i) { return 4; };
                        doc.content[1].layout = objLayout;
                        var obj = {};
                        obj['hLineWidth'] =  function(i) { return .5; };
                        obj['hLineColor'] = function(i) { return '#aaa'; };
                        doc.content[1].margin = [ 150, 0, 150, 0 ];
            }
            }
        ]

    } );
});

Answers

This discussion has been closed.