Discussion Locked

Notes / Domino R5 - integrating PDFs

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a whole bunch of Adobe PDF documents that I need integrating into a Notes/Domino db, accessible either by the Notes client or web-browser. I'd like the PDFs to be a seamless part of the doc (i.e. not iconised or spawning separate windows).
Can this be done? - if so, how?

1 reply

by greed

You need to embed your PDF into a rich text field. Below is an example of where I cycled through an Invoice file and attached the invoice to the appropriate notes document. What you need is similar but you need to embed not attach. Given the space I have I cannot provide you with examples of embedded objects but you can find good examples in Notes Help. Look for the EmbedObject method in the Lotus Script classes.

My code

Sub Initialize
' Dimension Variables
Dim pathName AsString
Dim separator As String
Dim fileName As String
Dim ReqNum As String
Dim Saveas As String
Dim ReqEnd As Integer
Dim Length As Integer
Dim RightSide As Integer
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim ndoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject

' Hard coded values. These are they only values that will change if optio
changes pathName$ = "c:\Notes\Data\Invoice\*.*"
separator = "^"

fileName$ = Dir$(pathName$, 0)
Do While fileName$ <> ""
' Set Variables
ReqEnd = Instr(fileName, separator ) -1
ReqNum$ = Left$ ( fileName , ReqEnd )
Length = Len(fileName)
RightSide = Length - (ReqEnd + 1)
Saveas$ = Right$ (fileName, RightSide)
SubPath = Left$ ( pathName , Len(pathName) - 3 )
Set db = ses.CurrentDatabase
Set view= db.GetView( "ReqNumber" )
Set ndoc = view.GetDocumentByKey( ReqNum)
' Attach file to doc then delete file
If Not ndoc Is Nothing Then
Set rtitem = New NotesRichTextItem( ndoc, "Attachment" )
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", SubPath &
fileName, Saveas )
Call ndoc.Save( True, True )
Kill SubPath & fileName

This discussion is closed to new replies.