Prompt for Password when creating PDF within MS Access Code

I have a VB application in MS Access 2003 which creates a PDF report and then attaches it to an email  We now need to password protect the PDFs and the password will be customised for each document created.  Here is the heart of the VB code that I use for creating the document: (apologies if code is supposed to be enclosed in tags but I can't see any help about posting code)

The code I'm using in VB is credited as follows:

'Author       : Ken Puls ( www.excelguru.ca)
'Macro Purpose: Print to PDF file using PDFCreator
'   (Download from http://sourceforge.net/projects/pdfcreator/ )
'   Designed for early bind, set reference to PDFCreator

    'Start PDF Creator
    Set pdfjob = New PDFCreator.clsPDFCreator
    With pdfjob
        If .cStart("/NoProcessingAtStartup") = False Then
            MsgBox "Can't initialize PDFCreator.", vbCritical + _
                    vbOKOnly, "PrtPDFCreator"
            Exit Sub
        End If
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = sPDFPath
        .cOption("AutosaveFilename") = sPDFName
        .cOption("AutosaveFormat") = 0    ' 0 = PDF
        .cClearCache
    End With

So I think there may be two options. 

One is that within the VB code I just pop up a box to get the user to type in the required password.  What would be the parameter I need e.g. would it be something like .cOption("AutosavePassword") = enteredPasswordString

Or is there a switch that I can put in that would pop up something from the PDFCreator interface itself to prompt the user for a password.

Many thanks.

 

Hi,

I think it will be enough to simply enable security
.cOption(“PDFUseSecurity”)= 1
.cOption(“PDFUserPass”) = 1
 PDFCreator does prompt for a password for every document by default. (if security is enabled)

regards,

Robin

Thanks Robin.  This is what I needed and it's working fine.  Is there a full list of the VBA commands anywhere?  I tried guessing at a few .cOption options but didn't manage to hit on UserSecurity and UserPass.

Regards
David

PS - Apologies if this post is repeated.  I hit Post Comment the first time and it disappeared.

Hi,

here is the place to look: http://www.pdfforge.org/content/com-interface

regards,

Robin

Thanks Robin.  I've followed that link but I must be missing something.  I can't see the comprehensive list of the .cOption options.  There are a few in there but nothing about the security and password options.  I've also looked at the sample code in the COM folder under pdfcreator but that doesn't show all the options and syntax. 

Sorry if it's obvious and I'm just not seeing it.

Hi,

if it is a setting only effecting a certain format, it will start with the name of the format e.g.:
Public PDFUseSecurity As Long
Public PDFUserPass As Long
Public PDFUserPasswordString As String
(all are there:))
regards,

Robin