Enhance the visual appeal and branding of your documents with the power of repeated or tiled watermarks. This innovative feature allows you to seamlessly integrate patterns of text or images across your pages, creating a professional and cohesive look. Whether you’re aiming for subtle branding, artistic expression, or document security, the ability to configure the spacing, rotation, and style of these watermarks provides unparalleled customization. Explore the possibilities and make your documents stand out with the elegance of tiled watermarks.
Text repeated watermark
The provided code snippet demonstrates how to add a tiled watermark to a document. To configure tiling settings, we can utilize the dedicated class TileOptions. In this example, we set the LineSpacing property, determining the spacing between parallel tiles, to 12 percent of the page size. Additionally, we define the WatermarkSpacing property, which sets the spacing between watermarks in the line, to be 10 percent of the page size. Next image helps to understand the purpose of LineSpacing and WatermarkSpacing settings:
Furthermore, we apply a watermark rotation of 30 degrees for added customization.
using(Watermarkerwatermarker=newWatermarker(Constants.InDocumentPdf)){// Initialize the font to be used for watermarkFontfont=newFont("Arial",19,FontStyle.Bold|FontStyle.Italic);// Create the watermark objectvarwatermark=newTextWatermark("Test watermark",font);// Configure tile optionswatermark.TileOptions=newTileOptions(){LineSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=12},WatermarkSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=10},};// Set watermark propertieswatermark.Opacity=0.3;watermark.RotateAngle=-30;// Add watermarkwatermarker.Add(watermark);watermarker.Save(Constants.OutDocumentPdf);}
The output of the aforementioned code is represented below, showcasing repeated text watermarks:
Additionally, the class TileOptions includes a TileType property, providing the ability to configure the tile view. The default value is Straight mode, but we can change it. For instance, in the previous example, if we add the setting
watermark.TileOptions.TileType=TileType.Offset
it enables the offset style. In the context of watermarks and tiling, the “offset style” refers to a specific arrangement where each tile is positioned with a shift or offset from the previous one. Instead of aligning tiles in a straightforward, parallel manner, the offset style introduces a displacement, creating a more dynamic and visually interesting pattern. This shift can occur horizontally, vertically, or both, depending on the specific settings applied.
In this case, the output will exhibit the following effect:
Image repeated watermark
The repeated watermark feature also supports image watermarks. The following C# code demonstrates how to add repeated image watermarks to a PDF document with rotation.
using(Watermarkerwatermarker=newWatermarker(Constants.InDocumentPdf)){// Initialize the font to be used for watermarkFontfont=newFont("Arial",19,FontStyle.Bold|FontStyle.Italic);// Create the image watermark objectvarwatermark=newImageWatermark(imagePath);// Configure tile optionswatermark.TileOptions=newTileOptions(){LineSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=12},WatermarkSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=10},};// Set watermark propertieswatermark.Opacity=0.3;watermark.RotateAngle=-30;// Add watermarkwatermarker.Add(watermark);watermarker.Save(Constants.OutDocumentPdf);}
This is the resulting appearance of the document after applying tiled image watermarks:
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.