DocRaptor Home
PDF Code Examples

Code Example: Watermark

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>
  <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)
  <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>

Ready to get started? Try DocRaptor for free with unlimited test documents.