GroupDocsGists
10/19/2017 - 11:07 AM

Documents-AddWatermarkToImageShapesPowerPointDocument.vb

' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
Using doc As SlidesDocument = Document.Load(Of SlidesDocument)("D:\test.pptx")
    ' Initialize image or text watermark
    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.IsBackground = True
    watermark.ScaleFactor = 1

    For Each slide As SlidesSlide In doc.Slides
        For Each shape As SlidesShape In slide.Shapes
            If shape.Image IsNot Nothing Then
                ' Add watermark to the image
                shape.Image.AddWatermark(watermark)
            End If
        Next
    Next

    doc.Save()
End Using