How to add text to a pdf file using Access VBA??
I'm down on my hands and knees, begging. I have 300 files that I want to put a variable string at the top of the first page (centered, or at the right hand side). I am using Acrobat X and Microsoft Access 2010 and I do have the SDK and have spend over 10 hours so far searching it and the internet in general, for help and still am coming up empty handed.
I can do the looping and passing variables with my eyes closed, but I cannot get the syntax for the actual opening of the pdf and inserting the string.
I was trying to modify code I found yesterday that is supposed to add an annotation, but I don't want an annotation, I just want a string of text at the top of page 1. For now, all I want is to be successful at doing ONE file. Can someone please give me a concrete example of the code I need to use? Like I said, I'm in begging mode ![]()
Public Sub AddText()
Dim pdDoc As Acrobat.AcroPDDoc
Dim page As Acrobat.AcroPDPage
Dim annot As Acrobat.AcroPDAnnot
Dim jso As Object
Dim strPath As String
Dim intpoint(1) As Integer
Dim intpopupRect(3) As Integer
Dim props As Object
Set pdDoc = CreateObject("AcroExch.PDDoc")
pdDoc.Open ("c:\Test\Test.pdf")
Set page = pdDoc.AcquirePage(0)
'Set annot = page.AddAnnot(0)
intpoint(0) = 0
intpoint(1) = page.GetSize.y
intpopupRect(0) = 0
intpopupRect(1) = page.GetSize.y - 100
intpopupRect(2) = 200
intpopupRect(3) = page.GetSize.y
annot.SetColor (vbRed)
annot.SetContents "JCPC - 22 - 2011050000001"
pdDoc.Save 1, "c:\Test\Test.pdf"
pdDoc.Close
Set pdDoc = Nothing
MsgBox "Done"
End Sub
