Forum How do I...?

Set different footers for left and right pages

msa
What I want is to have a different footer for left and right facing pages starting from the first content page. And the first content page is always left.

My pdf structure:

1 cover page
1-n pages of TOC
n pages of actual content

in HTML:

<div id="cover"></div>
<div id="toc"></div>
<div id="content">
   <div class="item">This item has enough content for 2 pdf pages</div>
   <div class="item">This item has enough content for only 1 page</div>
   <div class="item">This item has enough content for 2 pdf pages</div>
</div>


At first I tried the following css, but because I do not know the number of TOC pages, the first content page might be right facing.

@page:left {
   @bottom {
      content: "Left footer";
   }
}
@page:right {
   @bottom {
      content: "Right footer";
   }
}


test-1.pdf‎

Then I tried the following CSS, but the right footer only appears once. All the other pages had the left footer.

@page content {
   @bottom {
      content: "Left footer";
   }
}
@page content:nth(2) {
   @bottom {
      content: "Right footer";
   }
}

---

#content {
   page: content;
   prince-page-group: start;
}


test-2.pdf‎

Finally, I tried the following CSS, but the left/right footers only work inside div.item. If div.item has an odd amount of pdf pages, meaning that the last page has a left footer, the next .item starts with a left footer resulting in two pages with left footer next to each other.

@page content {
   @bottom {
      content: "Left footer";
   }
}
@page content:nth(2) {
   @bottom {
      content: "Right footer";
   }
}

---

#content .item {
   page: content;
   prince-page-group: start;
}



test-3.pdf‎

How should I change my approach to achieve a different footer for every other page, starting from the first content page?
  1. test-1.pdf58.6 kB
  2. test-2.pdf58.6 kB
  3. test-3.pdf58.6 kB
mikeday
If you want the first content page to always be a left facing page, you can specify "page-break-before: left" on the content element. This will leave a blank page if necessary, to ensure that it begins on a left facing page.
msa
Is there a way to do it without blank pages? It doesn't necessarily have to be left and right facing pages, just every other page starting from the content would be acceptable too.
mikeday
What about this:
@page content:left { ... }
@page content:right { ... }