Hi,
I installed a PDF Creator server instance on my server (Windows server 2008), and I deployed and shared it with the users on the domain. It works fine.
Now I want to use the COM interface in a MS Access / VBA application. It works well when I don't care about options, but when I want to configure the options (useAutosave, autosavedirectory, filename...), it looks like it cannot save them to the PDF Creator instance on the server, it just ignored them...
Here is my code :
Private Sub cmdPDF_Click()
Dim PDFCreator As clsPDFCreator
Dim pdfCreatorOptions As clsPDFCreatorOptions
Dim defaultPrinter As String
Set PDFCreator = New clsPDFCreator
Set pdfCreatorOptions = New clsPDFCreatorOptions
If PDFCreator.cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't Initiase PDF Converter", vbCritical, "Letter Generation Error"
Exit Sub
End If
With pdfCreatorOptions
.UseAutosave = 1
.UseAutosaveDirectory = 1
.AutosaveDirectory = "\\\\fileserver\\HomeFolders$\\"
.AutosaveFilename = "popidom.pdf"
.AutosaveFormat = 0 ' 0 = pdf
' .cPrinterStop = False
' .cDefaultPrinter = "PDFCreator"
' .cPrintFile sDocument
End With
Set PDFCreator.cOptions = pdfCreatorOptions
PDFCreator.cSaveOptions
PDFCreator.cClearCache
defaultPrinter = Application.Printer.DeviceName
Set Application.Printer = Application.Printers("\\\\fileserver\\PDFCreator")
If isComplete Then
Me.Refresh
checkIsSaved.Value = True
' sendConfirmationEmail txtCustomerID, txtCustomerType
DoCmd.OpenReport "Invoice", acPreview, , "InvoiceID=" & txtQuoteID, , txtQuoteID
DoCmd.SelectObject acReport, "Invoice"
' DoCmd.RunCommand acCmdPrint
DoCmd.PrintOut
Do Until PDFCreator.cCountOfPrintjobs = 1
DoEvents
Loop
PDFCreator.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until PDFCreator.cCountOfPrintjobs = 0
DoEvents
Loop
PDFCreator.cClose
DoCmd.Close acReport, "Invoice"
' DoCmd.Close acForm, "PopupQuote"
Else
MsgBox ("Please select " & missingFields)
End If
Set Application.Printer = Application.Printers(defaultPrinter)
Set pdfCreatorOptions = Nothing
Set PDFCreator = Nothing
End Sub
NOte : I added the reference to my VBA project.
Thanks
Julien