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("sample.pdf")){// Initialize the font to be used for watermarkFontfont=newFont("Arial",19,FontStyle.Bold|FontStyle.Italic);// Create the watermark objectvarwatermark=newTextWatermark("Watermark",font);watermark.ForegroundColor=Color.Red;// Configure tile optionswatermark.TileOptions=newTileOptions(){LineSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=12},WatermarkSpacing=newMeasureValue(){MeasureType=TileMeasureType.Percent,Value=10},};// Set watermark propertieswatermark.Opacity=0.2;watermark.RotateAngle=-30;// Add watermarkwatermarker.Add(watermark);watermarker.Save("result.pdf");}
The output of the above mentioned code is represented below, showcasing repeated text watermarks:
The common rotation of watermarks on the above image is done relative to the left edge of the document. It’s also possible to do the common rotation relative to the bottom left edge of the document. For this need to set property RotateAroundOrigin of the class TileOptions in the true.
watermark.TileOptions.RotateAroundOrigin=true;
In such case the result of repeated watermark looks like this:
Class TileOptions includes a TileType property, providing the ability to configure the tile template. 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:
The TileType enum supports a range of tile templates, including OneThirdOffset and BasketWeave, to accommodate diverse design needs. Setting
It produces the following visual result for the BasketWeave tile watermark pattern in the document:
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("sample.pdf")){// 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("result.pdf");}
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.