A Quarto extension to add watermark for html and pdf document. It's based on X-Watermark for html document, draftwatermark package for pdf document.
Caution
pdflatex PDF engine is not supported.
quarto add leovan/quarto-watermarkThis will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.
Put this in the header of your document, or in the _quarto.yml file.
filters:
- watermarkParameters for this extension are listed as below:
| Parameters | Default | Format | Description |
|---|---|---|---|
text |
Watermark | All | Watermark text, single line supported only. |
size |
1 | All | Watermark font size. |
angle |
15 | All | Watermark angle in degrees. |
color |
#000000 | All | Watermark color in Hex format. |
opacity |
0.1 | All | Watermark opacity. |
cols |
10 | pdf |
# of watermark columns. |
rows |
50 | pdf |
# of watermark rows. |
x-space |
4 | All | Space size between watermark columns. |
y-space |
4 | All | Space size between watermark rows. |
z-index |
-1 | html |
Stack order of watermark. |
html-font |
html |
Watermark font. | |
pdf-font |
pdf |
Watermark font. |
Note
remis used as unit for all length, width and size forhtmldocument.emis used as unit for all length, width and size forpdfdocument.- Positive
anglewill rotate counterclockwise, and vice versa. A value between -90 and 90 is required, and a value between -45 and 45 is suggested. colorshould be in Hex format.opacityshould be between 0 and 1.- All decimal values should keep two decimal places at most.
html-fontdefault value issystem-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', which is compatible with common operation system.pdf-fontdefault value is empty, which will use\normalfontas default font.
Here is the source code for a minimal example: example.qmd.
The MIT License (MIT)
Copyright (c) 2024 范叶亮 | Leo Van