Skip to content

Styling based on odd/even page position #3205

Answered by ghost
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Based on the callbacks solution from #3178 (reply in thread)

<div class="node footer">
  <div class="footer-start" role="show-on-odd">
    <div class="type caption">
      <span class="page_number"></span>
      <span style="margin: 0mm 2mm;"></span>
      <span class="page_title"></span>
    </div>
  </div>
  <div class="footer-end" role="show-on-even">
    <div class="type caption">
      <span class="page_number"></span>
    </div>
  </div>
</div>
$dompdf->setCallbacks([
  [
    'event' => 'begin_frame',
    'f' => function ($frame, $canvas, $fontMetrics) {
      $n = $frame->get_node();
      $p = $canvas->get_page_number();

      $role = $n->hasAttributes() && //
        ($a = $n->

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@bsweeney
Comment options

@ghost
Comment options

@bsweeney
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant