vbscript WatermarkOperations-AddWatermarkToImages.vb

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript WatermarkOperations-AddWatermarkToImages.vb相关的知识,希望对你有一定的参考价值。

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

    ' Initialize image watermark
    Using imageWatermark As New ImageWatermark("D:\protect.jpg")
        imageWatermark.HorizontalAlignment = HorizontalAlignment.Center
        imageWatermark.VerticalAlignment = VerticalAlignment.Center
        imageWatermark.RotateAngle = -45
        imageWatermark.SizingType = SizingType.ScaleToParentDimensions
        imageWatermark.ScaleFactor = 1

        ' Find all images in a document
        Dim images As WatermarkableImageCollection = doc.FindImages()

        For i As Integer = 0 To images.Count - 1
            If images(i).Width > 100 AndAlso images(i).Height > 100 Then
                If i Mod 2 = 0 Then
                    images(i).AddWatermark(textWatermark)
                Else
                    images(i).AddWatermark(imageWatermark)
                End If
            End If
        Next
    End Using
    doc.Save()
End Using

以上是关于vbscript WatermarkOperations-AddWatermarkToImages.vb的主要内容,如果未能解决你的问题,请参考以下文章

vbscript VBSCRIPT_EMAIL

vbscript SHA-256哈希的VBScript代码

vbscript 使用VBScript发送电子邮件

vbscript VBScript:运行本地或远程策略。

vbscript VBScript将可用磁盘空间写入文件

vbscript VBScript或VBA数组函数