Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Different Page Header/Footer #211

Open
mprythero opened this issue Nov 9, 2021 · 0 comments
Open

Different Page Header/Footer #211

mprythero opened this issue Nov 9, 2021 · 0 comments

Comments

@mprythero
Copy link

Using the niklasravnsborg / laravel-pdf package, is there a way to create a header and/or footer based on whether or not a page is an odd or an even page?

I haven't been able to find anything that suggests it's possible, but I also haven't found anyone specifically inquiring about this issue.

If I did something like this styling in the html document:

         @page {
            odd-header-name: odd-header;
            even-header-name: even-header;
            odd-footer-name: odd-footer;
            even-footer-name: even-footer;
}

And this in the body:

<htmlpageheader name="odd-header">
    <div style="text-align: center">MUNICIPAL CODE</div>
</htmlpageheader>

<htmlpageheader name="even-header">
    <div style="text-align: center">MUNICIPAL CODE</div>
</htmlpageheader>

<htmlpagefooter name="even-footer">

    <div style="float:left; width: 50%;">
        EvenTitle {{$title->number}} - {{$title->title}}
    </div>

    <div style="float:right; width: 40%; text-align: right;">Page {PAGENO} of {nb}</div>
</htmlpagefooter>

<htmlpagefooter name="odd-footer">

    <div style="float:right; width: 50%;">
        OddTitle {{$title->number}} - {{$title->title}}
    </div>

    <div style="float:left; width: 40%; text-align: right;">Page {PAGENO} of {nb}</div>
</htmlpagefooter>

Only the odd versions appear. Does anyone have any workarounds or suggestions?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant