Click here to Skip to main content
15,946,320 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)

My table has two header rows, DataTable is showing bother header rows but not exported to pdf please help.

My table is:
<table id="example" class="table table-striped table-sm table-bordered nowrap" style="width:100%">
	<tr><th colspan="2"><?php if(isset($session)){ echo $session; } ?> - <?php if(isset($class)){ echo $class; } ?>
			- <?php if(isset($section)){ echo $section; } ?></th></tr>
			<th class="text-primary">Roll #</th>
			<th class="text-primary">Student Name</th>
	<?php if(isset($rows)) { ?>
		<?php foreach($rows as $row) { ?>		  
	  <?php  } ?>
	<?php  } ?>

DataTable Image

PDF Output
Please help, thanks in advance.

What I have tried:

        header: true,
        dom: 'Blfrtip',
        search: true,
            iDisplayLength: 10,
            lengthMenu: [
            [ 10, 25, 50,100, -1 ],
            [ '10 rows', '25 rows', '50 rows','100 rows', 'Show all' ]
            buttons: [
                extend: 'pdfHtml5',
                orientation: 'landscape',
                pageSize: 'LEGAL'
Updated 20-Aug-22 2:35am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900