Print Option does not render background image

Print Option does not render background image

jadiijadii Posts: 1Questions: 1Answers: 0

I know the same question has been asked before, but i am facing it in a different scenario .It works fine if i initially hit the print button it displays the background image but when i again hit the print button i does not show until i refresh the page, can anyway help sorting this out, below is the code:

var tablee=$('.dataTables-example').DataTable({
                pageLength: 25,
                responsive: true,
                "bLengthChange": false,
                dom: '<"html5buttons"B>lTfgitp',
                buttons: [
                    { extend: 'copy',exportOptions:{columns: ':visible'}},
                    {extend: 'csv',exportOptions:{columns: ':visible'}},
                    {extend: 'excel',exportOptions:{columns: ':visible'}},

                    {extend: 'print',

                        title: "",
                        exportOptions:{
                            stripHtml: false,
                            columns: ':visible'
                        },

                        //For repeating heading.
                        repeatingHead: {
                            logo: '{{ asset("img/logo.png") }}',
                            logoPosition: 'left',
                            logoStyle: 'width:8%',
                            title: '<h4>test address</h4><h4>test contact</h4>',
                        },
                        customize: function (win){
                            $(win.document.body).addClass('white-bg');
                            $(win.document.body)
                                    .css('font-size', '10px')
                                    .prepend(
                                        '<img src="{{ asset("img/logo.png") }}" style="opacity: 0.1;position:absolute; top:100; left:350;" />'
                                    );

                            $(win.document.body).find('table')
                                    .addClass('compact')
                                    .css('font-size', 'inherit');
                        },
                    },
                    'colvis'
                ]

            });

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

This discussion has been closed.