Question

Header not coming in first page but comming in all other pages in mpdf.

here is my php code.

$mpdf   = new mPDF('utf-8','A4','','' , 0 , 0 , 0 , 18 , 0 , 0);
        $mpdf->SetDisplayMode('fullpage');
        $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
        $htmlFilePath   = $fileName;
        //$mpdf->SetHTMLHeaderByName('header');
        $mpdf->WriteHTHeader not coming in first page mpdfML(file_get_contents($htmlFilePath));

here is my html code part.

<htmlpageheader name="header">
                <td class="" colspan="2">
                    <div id="header">
                        <table  cellpadding="0" cellspacing="0" border="0" align="center">
                            <tr><td height="10"></td></tr>
                            <tr>
                                <td colspan="2">
                                    <table border="0" cellpadding="0" cellspacing="0" align="center" width="200mm">
                                        <tr><td align="center"><img src="{ADMINURL}wc_bo/wc_images/wc_background/pdf_header.jpg" width="739" height="206" alt=""></td></tr>
                                    </table>
                                </td>
                            </tr>
                     </table>
                    </div>
                    <!-- <table align="center"  cellpadding="0" cellspacing="0" border="0"  style="width:180mm;">
                        <tr>
                            <td colspan="2" ><img src="{ADMINURL}wc_bo/wc_images/wc_background/login_logo.jpg" width="242" height="" alt=""></td>
                        </tr>
                    </table> -->
                </td>
            </htmlpageheader>
            <sethtmlpageheader name="header" value="on" />
Was it helpful?

Solution

 Remove your <sethtmlpageheader name="header" value="on" /> and put this code.

<sethtmlpageheader name="header" page="O" value="on" show-this-page="1" />
<sethtmlpageheader name="header" page="E" value="on" />

OTHER TIPS

You can also use the format below

$mpdf->SetHTMLHeader('$htmlcode','',TRUE);

this also bring header in the first page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top