Repeated (tiled) watermarks let you cover entire pages with a pattern of text or images. You can control spacing, rotation, offsets, and choose different tiling templates by setting tile_options on the watermark.
Add a repeated text watermark
The example below tiles a diagonal text watermark across the whole page. The line_spacing and watermark_spacing are expressed as a percentage of the page, and tile_type selects the tiling template.
fromgroupdocs.watermarkimportWatermarkerfromgroupdocs.watermark.watermarksimport(TextWatermark,Font,Color,TextAlignment,TileOptions,TileType,MeasureValue,TileMeasureType,)defadd_repeated_watermark():withWatermarker("./sample.pdf")aswatermarker:watermark=TextWatermark("CONFIDENTIAL",Font("Arial",19.0))watermark.foreground_color=Color.graywatermark.opacity=0.3watermark.rotate_angle=-45.0watermark.text_alignment=TextAlignment.CENTER# Spacing between lines and between repeated watermarks, as a percentage of the pageline_spacing=MeasureValue()line_spacing.measure_type=TileMeasureType.PERCENTline_spacing.value=12.0watermark_spacing=MeasureValue()watermark_spacing.measure_type=TileMeasureType.PERCENTwatermark_spacing.value=10.0# Tile the watermark across the whole pagetile_options=TileOptions()tile_options.tile_type=TileType.ONE_THIRD_OFFSETtile_options.line_spacing=line_spacingtile_options.watermark_spacing=watermark_spacingwatermark.tile_options=tile_optionswatermarker.add(watermark)watermarker.save("./output.pdf")if__name__=="__main__":add_repeated_watermark()
sample.pdf is the sample file used in this example. Click here to download it.
You can replace the TextWatermark with an ImageWatermark to tile a logo or seal across the page in the same way — set the same tile_options on the image watermark.
Use case: Protect sensitive PDFs by overlaying a tiled “Confidential” text across every page, or reinforce branding by repeating a logo in the background.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.