GroupDocsGists
10/19/2017 - 11:01 AM

AddWatermarkToImagesVisio.vb

' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
Using doc As DiagramDocument = Document.Load(Of DiagramDocument)(Utilities.MapSourceFilePath(FilePath))
    Dim watermark As New TextWatermark("Protected image", New Font("Arial", 8))
    watermark.HorizontalAlignment = HorizontalAlignment.Center
    watermark.VerticalAlignment = VerticalAlignment.Center
    watermark.RotateAngle = 45
    watermark.SizingType = SizingType.ScaleToParentDimensions
    watermark.ScaleFactor = 1

    ' Get all images from the first slide
    Dim images As WatermarkableImageCollection = doc.Pages(0).FindImages()

    ' Add watermark to all found images
    For Each image As WatermarkableImage In images
        image.AddWatermark(watermark)
    Next

    doc.Save()
End Using