Ellis
Ellis

Reputation: 328

DOMPDF start paging at

I would like to know how set DOMPDF library (https://github.com/dompdf/dompdf) to start paging from given value?

Default behavior: starts at 1

Wanted behavior: start at let's say 3

Upvotes: 0

Views: 1555

Answers (1)

BrianS
BrianS

Reputation: 13914

Use CSS and increment the page counter. So long as your increment element appears before you insert the page number this will work:

<html>
<head>
  <style>
  .move-ahead { counter-increment: page 2; position: absolute; visibility: hidden; }
  .pagenum:after { content:' ' counter(page); }
  </style>
</head>
<body>
  <div class="move-ahead"></div>
  <p class="pagenum">Page</p>
</body>
</html>

Upvotes: 2

Related Questions