Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically Add Watermark to PDF Document 3

Status
Not open for further replies.
Not a real expert on PDF documents, but I do know that Adobe's software for creating and/or editing them is about $700, whereas the software for reading them is free. It sounds like what you're trying to do is alter a pdf document. You might want to check Adobe's site for how to accomplish this.

HTH

Bob
 
Thanks for the tips.

Swi
 
Actually I found a way to do it through code:

Option Explicit

Private Sub Command1_Click()
ApplyBackgroundToPDF "C:\PDIANR-0606-203135.pdf", "C:\Proofing.pdf", "C:\TESTIT.PDF"
MsgBox "Complete!", vbInformation
End Sub

Private Function ApplyBackgroundToPDF(BasePDF As String, BackgroundPDF As String, OutputPDF As String)
Dim pdDoc As Acrobat.AcroPDDoc
Dim fso As New FileSystemObject
Dim template As Variant

'Check for existence of output file
If fso.FileExists(OutputPDF) Then fso.DeleteFile OutputPDF

'Open base document
Set pdDoc = CreateObject("AcroExch.PDDoc")
pdDoc.Open BasePDF
DoEvents

'Initialize JavaScript
Set template = pdDoc.GetJSObject

'Place the template as a watermark
template.addWatermarkFromFile BackgroundPDF

'Save
pdDoc.Save 1, OutputPDF

'Close & Destroy Objects
pdDoc.Close
Set pdDoc = Nothing
Set template = Nothing
Set fso = Nothing
End Function

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top