Hello,
I add a watermark to PDFcreator (AddWatermarkToPDF). It's working great! When I make a WORDdocument and I print it with PDFcreator it makes a PDF with the watermark.
But now I want one watermark on the first page and another one on the second and the following pages. How can I make this?
This is the code I now have:
Option Explicit
Const AppTitle = "PDFCreator - AddWatermarkToPDF"
Const PathToPdftk = "C:\\Program Files\\PDFCreator\\pdftk.exe"
Const WatermarkPDF = "watermark.pdf"
Dim objArgs, fname, tfname, fso, WshShell, oExec
Set objArgs = WScript.Arguments
If objArgs.Count = 0 Then
MsgBox "This script needs a parameter!", vbExclamation, AppTitle
WScript.Quit
End If
fname = objArgs(0)
Set fso = CreateObject("Scripting.FileSystemObject")
If Ucase(fso.GetExtensionName(fname)) <> "PDF" Then
MsgBox "This script works only with pdf files!", vbExclamation, AppTitle
WScript.Quit
End If
If Not fso.FileExists(PathToPdftk) Then
MsgBox "You need pdftk for this script!" & vbcrlf & vbcrlf & _
"Please go to http://www.accesspdf.com and download it.", vbExclamation, AppTitle
WScript.Quit
End If
If Not fso.FileExists(WatermarkPDF) Then
MsgBox "Can't find the watermark pdf file!", vbExclamation, AppTitle
WScript.Quit
End If
Set WshShell = CreateObject("WScript.Shell")
tfname = fso.GetTempName
WshShell.Run """"&PathToPdftk&"""" & " """ & fname & """ background " & " """ & WatermarkPDF & """ output """ & tfname & """",0,true
If Not fso.FileExists(tfname) Then
MsgBox "There was an error using ""pdftk""!", vbCritical, AppTitle
WScript.Quit
End If
If fso.FileExists(fname) Then
fso.DeleteFile(fname)
End If
fso.MoveFile tfname, fname
Can somebody help me with the code?
Greets Roos