Skip to main content
All CollectionsPDF Code Examples
Code Example: Watermark
Code Example: Watermark
Jonathon Fruchte avatar
Written by Jonathon Fruchte
Updated over 4 years ago

Here's an example of how to make a simple text-based watermark for your document.

WARNING! This code only works with non-test mode documents. Test-mode watermarks will override this watermark.

<!DOCTYPE html>
<html>
<head>
  <title>Watermark Test</title>
  <style type="text/css">
  .break-after {
    page-break-after: always;
  }

  #watermark {
    flow: static(watermarkflow);
    font-size: 120px;
    opacity: 0.5;
    transform: rotate(-30deg);
    text-align: center;
  }

  @page {
     @prince-overlay {
        content: flow(watermarkflow)
     }
  }
  </style>
</head>
<body>
  <div id="watermark">PREVIEW</div>
  <div class="break-after">Page 1</div>
  <div class="break-after">Page 2</div>
  <div class="break-after">Page 3</div>
</body>
</html>
Did this answer your question?