troubleshooting Question

Lotus Notes launching an attached Adobe FDF file

Avatar of Moonshadow
Moonshadow asked on
Lotus IBM
3 Comments1 Solution489 ViewsLast Modified:
Here's the situation:
     I have a form built in Notes that has fields in it that match those of an Adobe PDF form (FDF). I have code (taken from the Adobe ActiveX Integration text and modified) that dumps the Notes field values into an FDF form that gets saved to disk and then attached to the Notes document. So far, so good.

     If the user wishes to print the data, they have to double-click the FDF attachment and launch it into the Acrobat reader. This will automatically load the associated PDF file and fill in its fields with the data.  Again, this is good.

The problem:
     I would like to set up a button that grabs the attachment (through code) and launches it, sends the print command and closes the doc, all without the user getting involved.  I've tried embedding the FDF document in a rich-text field, but it won't work for some reason. I'm desperate for suggestions on how I can resolve this.

Here's the code in question:

Button to dump fields and create FDF:
The code essentially creates an FDF object in memory, builds a random filename, reads the Notes field data and pushes it into the FDF fields, saves the FDF and attaches it to the document.
Sub Click ( Source As Button )
Dim uiws As New NotesUIWorkspace
Dim fdfacx As Variant
Dim outputFDF As Variant
Dim sPdfFilename As String
Dim sfdffilename As String
Dim sfilepath As String

Set fdfacx = CreateObject ( "FdfApp.FdfApp" )
Set outputFDF = fdfacx.FDFCreate ()
sPdfFileName = "C:\Temp\cms700.pdf"
sfilepath = "C:\Temp\"

Dim session As New NotesSession
Dim contextDoc As NotesDocument
Dim dateTime As NotesDateTime
Dim tempNumber As Single
Dim rounded As Integer
Dim fileName As String
Set contextDoc = uiws.CurrentDocument.Document

temp = Rnd
rounded = Round ( ( temp * 100 ), 0 )
fileName = Cstr ( rounded )
sFdfFileName = sFilePath & fileName & ".fdf"

outputFDF.FDFSetValue "LastName", contextDoc.LastName (0), False
outputFDF.FDFSetValue "MiddleInitial", contextDoc.MiddleInitial (0), False
outputFDF.FDFSetValue "FirstName", contextDoc.FirstName (0), False

outputFDF.FDFSetFile sPdfFileName
outputFDF.FDFSaveToFile sFdfFileName


Call MoveFdfToAttachment ( contextDoc, sFdfFileName )
End Sub


Function MoveFdfToAttachment ( doc As NotesDocument, fileName As String ) As Integer
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject

Set rtitem = New NotesRichTextItem ( doc, "fdfAttachment" )
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", fileName )

doc.Filename = fileName
Call doc.Save ( True, True )
' Kill fileName
MoveFdfToAttachment = True
End Function

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros