Skip to main content
Inspiring
May 7, 2016
Question

Problems with VBA and javascript

  • May 7, 2016
  • 2 replies
  • 1826 views

I am a long time (mostly mainframe PL/1) programmer, now retired,  and a self-taught VBA programmer. I have little experience of javascript.

I am trying to add a watermark to an existing PDF using VBA from MIcrosoft Access.

Here is a code snippet:

<-----

' This works OK

' add a form field

Set Field = jso.addField("myFormField", "text", 0, rect)

Field.Value = "Testing"

' add a watermark

' ********* This works

jso.addWatermarkFromText ("Testing text")

' ********* Below gives a syntax error - if I add ANYTHING after "Confidential"

' ********* The Acrobat API reference says this is the syntax

jso.addWatermarkFromText ("testing text", 0, font.Helv, 24, color.red)

--->

I suspect I'm missing something obvious - can anyone help?

    This topic has been closed for replies.

    2 replies

    Nancy OShea
    Community Expert
    Community Expert
    May 8, 2016

    I don't use Access for anything anymore.  There was a time a l-o-n-g time ago when I did.

    I mainly work with MySQL data and I never put physical images into a database, only their urls.  The physical files reside on the computer or remote server.

    That said, when I need to watermark a PDF, I use Photoshop or the built-in Acrobats tools -- no special coding required.

    Add watermarks to PDFs in Adobe Acrobat DC

    Nancy O.

    Nancy O'Shea— Product User & Community Expert
    Inspiring
    May 9, 2016

    The full story is that I created and continue to maintain an administration system written in Access for a club I belong to. They are trying to come into the 21st century and email the membership renewals rather than using snail mail. So I am wanting to extract membership info from the database (no problems there) and use that to personalize PDF membership renewal docs (where I am struggling)  and send them as email attachments to the members (again, no problem). The longer term goal is to do it all online, but that ain't gonna happen any time soon.

    As I said in the original post I can write VBA code and have done a little javascript in that context, but I'm struggling a bit here. As far as I can see the best way to personalize the docs is to add the text as a series of watermarks. If you can suggest any other option, I'd love to hear it. I've worked out how to add form fields, but that is not really what I want.

    Nancy OShea
    Community Expert
    Community Expert
    May 10, 2016

    Yeah.  Microsoft Word + document Mail Merge with your Access db. 

    Use Outlook to send renewals.

    Why do you need PDFs for this?

    Nancy O.

    Nancy O'Shea— Product User & Community Expert
    Inspiring
    May 7, 2016

    Whoops!. Please read "testing text" instead of "Confidential".