많은 수의 PDF 문서가 있으며 모든 페이지에서 워터 마크가 수동으로 검사됩니다. 스크립트를 통해 자동화가 가능합니까? 각 페이지에는 워터 마크가 하나만 있습니다. 또한 모든 페이지에 워터 마크가없는 파일 이름이나 문서 목록을 반환하는 것이 좋습니다.여러 PDF 문서의 모든 페이지에서 워터 마크를 검사하는 스크립트
-2
A
답변
0
pdf의 워터 마크가 OCG 개체에 저장됩니다. 따라서이 객체가 pdf에 있는지, 그리고 워터 마크가 있는지 여부를 acrobat에게 묻습니다.
첨부 할 수있는 VBS/VBA 코드를 첨부하십시오. 이 코드는 메모장에 복사 한 다음 바탕 화면에 "FindWatermarks.vbs"로 저장할 수 있습니다. 그런 다음 &을 끌어다 놓으면 pdf에 워터 마크가 포함되어 있는지 여부를 알려줍니다. 행운을 빌어 요, Reinhard
추 신 :이 스크립트는 Adobe Acrobat $$$ 버전에서만 작동하며 Reader는 사용할 수 없습니다!
'// test dropped files for included watermarks
set WshShell = CreateObject ("Wscript.Shell")
set fs = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
'// check if files has been dropped on the script
if objArgs.Count < 1 then
msgbox("Please drag a file on the script")
WScript.quit
else
msgbox("Files Count: "& objArgs.Count &vblf &"Start with file: " & ObjArgs(0))
end if
'//contact Acrobat
Set App = CreateObject("AcroExch.App")
App.show 'comment or take out to work in hidden mode
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AForm = CreateObject("AFormAut.App") 'from AFormAPI
'// write needed js code into vbs variable
js = "var found "&vblf _
& "var ocgArray = this.getOCGs();" &vblf _
& "if (ocgArray == null) { " &vblf _
& " found = 0; " &vblf _
& " }else{ " &vblf _
& " for (var i=0; i < ocgArray.length; i++) { " &vblf _
& " if (ocgArray[i].name == 'Watermark') { " &vblf _
& " found= 1; " &vblf _
& " }else{ " &vblf _
& " found = 0; " &vblf _
& " } " &vblf _
& " } " &vblf _
& " }"
filesWithWm = ""
filesExWm =""
'//open files via Avdoc and check for watermarks
for i=0 to objArgs.Count - 1
FileIn = ObjArgs(i)
If AVDoc.Open(FileIn, "") Then
'msgbox(FileIn)
Set PDDoc = AVDoc.GetPDDoc()
Set jso = PDDoc.GetJSObject
AForm.Fields.ExecuteThisJavaScript js
if jso.found = 1 then
filesWithWm = filesWithWm &FileIn &vblf
else
filesExWm = filesExWm &FileIn &vblf
end if
end if
next
'// report found files
if InStr(filesWithWm,":\")>0 then msgbox("Watermarks found:" &vblf & filesWithWm)
if InStr(filesExWm,":\")>0 then msgbox("No Watermarks found:" &vblf & filesExWm)
'// exit application
App.CloseAllDocs
App.Exit
Set AForm = Nothing
Set JSO = Nothing
Set PDDoc = Nothing
Set AVDoc = Nothing
Set App = Nothing
작은 코드 변경이 필요한 경우 알려주십시오.