External font-family for print export (datatables)

External font-family for print export (datatables)

markglahnmarkglahn Posts: 2Questions: 1Answers: 0

Hello,
I am using datatables and also the extension to generate a print view. But I need to use a specific font which I using on the webpage. I am not able to use this in the print view. All my comands are ignored.

Even just to change the font to standard Times New Roman is ignored how I do it:
Any idea how I can change the font?

My own fonts are included like this:

@font-face { font-family: 'Helvetica';
     src: url('/font/HelveticaNeueLTPro-LtCn.ttf') format('truetype'); }
@font-face { font-family: 'Helvetica';
     src: url('/font/HelveticaNeueLTPro-BdCn.ttf') format('truetype');
     font-weight: bold; }
@font-face { font-family: 'Basil';
     src: url('/font/Basil-Regular.otf') format('truetype'); }

The datatable part looks like this:

$(document).ready(function() {
    $('#example').DataTable( {
        "dom": 'Bfrtip',
                "lengthMenu": [
            [ 10, 25, 50, -1 ],
            [ '10 Zeilen', '25 Zeilen', '50 Zeilen', 'Alle Zeilen' ]
        ],
            "buttons": [
        'pageLength',
                    {
                extend: 'print',
                text: 'Drucken',
                customize: function ( win ) {
                    win.defaultStyle.font = 'Times New Roman';
                },
                autoPrint: false
            }
                ,'pdf','csv'
    ],        
        "processing": true,
        "serverSide": true,
        "language": {
            "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
        },
        "ajax": $.fn.dataTable.pipeline( {
            url: '/vertragsliste_load.php',
            pages: 5 // number of pages to cache
        } )
    } );
} );

Any idea how I can do this?

Thanks
Mark

Answers

This discussion has been closed.