|
楼主 |
发表于 2024-7-9 18:17
来自手机
|
显示全部楼层
Sub JSOaddWatermarkFromFils() '添加图片水印
Dim jso As Object, lRet As Long
Set AcroApp = CreateObject("AcroExch.App")
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroPDDoc = CreateObject("AcroExch.PDDoc")
oldpdf = ThisWorkbook.Path & "\Num.pdf"
newpdf = ThisWorkbook.Path & "\newnum.pdf"
giffile = ThisWorkbook.Path & "\123.gif"
lRet = AcroApp.CloseAllDocs
lRet = AcroPDDoc.Open(oldpdf)
If lRet = False Then GoTo JSO_add:
Set jso = AcroPDDoc.GetJSObject
jso.addWatermarkFromFile giffile, 0, 0, 0
JSO_add:
lRet = AcroPDDoc.Save( _
1 + PDSaveLinearized + _
PDSaveCollectGarbage, newpdf)
lRet = AcroApp.Hide
lRet = AcroApp.Exit
Set jso = Nothing
Set AcroPDDoc = Nothing
Set AcroAVDoc = Nothing
Set AcroApp = Nothing
End Sub |
|