GroupDocs.Watermark for .NET 23.11 Release Notes

Full list of changes in this release

KeyCategorySummary
WATERMARKNET‑1487FeatureDevelop a page setup feature

Pages setup feature for documents that could have pages

The ‘Pages Setup’ feature encompasses a set of mechanisms and options enabling users to precisely designate the pages within a document where a watermark should be applied.

//Apply a watermark to first, last and even pages of the PDF document
PdfLoadOptions loadOptions = new PdfLoadOptions();
using (Watermarker watermarker = new Watermarker("test.pdf", loadOptions))
{
    TextWatermark textWatermark = new TextWatermark("This is a test watermark", new Font("Arial", 48));
    textWatermark.PagesSetup = new PagesSetup
                                          {
                                              AllPages = false,
                                              FirstPage = true,
                                              LastPage = true,
                                              OddPages = false,
                                              EvenPages = true
                                          };
    
    PdfArtifactWatermarkOptions textWatermarkOptions = new PdfArtifactWatermarkOptions();
    watermarker.Add(textWatermark, textWatermarkOptions);
    watermarker.Save("result.pdf");
}

//Apply a watermark to all pages of the spreadsheet document
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
using (Watermarker watermarker = new Watermarker("spreadsheet.xls", loadOptions))
{
    TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
    textWatermark.PagesSetup = new PagesSetup
                               {
                                   AllPages = true,
                                   FirstPage = false,
                                   LastPage = false,
                                   OddPages = false,
                                   EvenPages = false
                               };
    
    watermarker.Add(textWatermark);
    watermarker.Save("result.xls");
}