This is how i have merged my header and footer with my content coming from view page,i have used all the css according to the resources i found online and my header and footer is displaying on every page perfectly.But when my table breaks to a second page the header on the second page overlaps my table content.I tried every possible solution but nothing seems to workout.(Thanks in advance)
$headerHtml = '<div style="position: fixed; top: -20px; left: 0px; right: 0px; height: 50px;><div style="height: 50px; display: inline-block;"><img src="'. asset("images/logoo.jpg") .'" alt="Logo" style="height: 40px; width: auto; vertical-align: middle;"><div style="float:right;"><p style="font-size: 12px;">Worldwide Campus LLP <br>Authorized Agent for Feel At Home </p></div></div></div>'; // Render the footer HTML $footerHtml = '<div style="position: fixed; bottom: 0; left: 0; right: 0; height: 30px; text-align: center; line-height: 30px;"><script type="text/php"> if (isset($pdf)) { $font = $fontMetrics->get_font("Arial, Helvetica, sans-serif", "normal"); $size = 10; // Calculate X coordinate for horizontal centering $x = 270; // Assuming A4 paper width is 595 units, and div width is 175 units // Calculate Y coordinate for vertical centering $y = 800; // Half of the div height $pdf->page_text($x, $y, "Page {PAGE_NUM} of {PAGE_COUNT}", $font, $size); }</script></div>'; $tableContent = $this->extractTableContent($view); $contentHtml = '<div style="margin-top: 50px;">' . $tableContent . '</div>'; // Combine header, footer, and main content $pdfHtml = $headerHtml . $contentHtml . $footerHtml;