Link to home
Start Free TrialLog in
Avatar of shrihalbe
shrihalbe

asked on

Lotus notes - pdf

I have been designing Lotus notes database for lotus notes environment. In that database each document has tobe a link [pDF is not part of the database it is stored some where in the server harddrive] for corresponding PDF File. I have certain question.

1. How to create the link to the PDf File in the Lotus notes. So that user click on that link and PDf file gets open.
2. Is it possible to print that file directly from the lotus notes environment. Even if the user is accessing the database from his machine and pdf file has been located on the server?
3. Another requirement if user wants to replicate the database then he/she should be able to replicate the pdf files from the server to his own machine.

4. is it posssible to check whethere replica of current database is available on user machine

Please help me. It is urgent.

thanks,
Shrirang
Avatar of HemanthaKumar
HemanthaKumar

One way is to include the pdf with database. Then you can replicate and keep the two dbs in Sync.

It is possible to check whether there is a replica copy of the same db. For that use OpenByReplicaID method

If your users are all located in same network (intranet) then you can use a script to load the pdf file with unc path.

For eg in postopen of the document use this api

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (Byval hwnd As
                     Long, Byval lpOperation As String, Byval lpFile As String, Byval lpParameters As String,
                     Byval lpDirectory As String, Byval nShowCmd As Long) As Long

                     Dim hwnd As Long 'the windows handle dont need to initalize
                     Dim lpOperation As String
                     Dim lpFile As String
                     Dim lpParameters As String
                     Dim lpDirectory As String
                     Dim nShowCmd As Long
                     Dim Hwin32 As Long 'the windows target handle dont need to initalize

                     'Initialize the vars
                     lpFile = "Filename.txt" 'Describe the file name
                     lpDirectory = "\\Server\Path" 'Describe file location
                     nShowCmd = 1 'Show the open file
                     lpOperation = "Open" 'if you want to print the file change to "Print"
                     'and finally execute the file
                     Hwin32 = ShellExecute(hwnd,lpOperation,lpFile,"",lpDirectory,nShowCmd)


~Hemanth



Avatar of shrihalbe

ASKER

Hello Hemanth,
  thanks very much
 i am really new in this area so can you explain it. i am not understanding properly. i am realy in mess. can you give your email id.

1. i don't want the pdf tobe a attachment to the document . i want pdf should be on the different location on the server.  and there should be some link in the document so user clicks on the link and PDF file gets open .

for this scenario do you have better solution
pleae let me know
Hi Hemanth ,
  another thing i want to ask you. to call API what special things i have to do. otherwise is it possibe to call api in normal way. can you  give some more insight on API that would be great. what is UNC. where i can find all these information?

  can it be possible using that api i can replicate perticular PDF related to the  Local Machine of the user?

Thanks for Your Help

Shrirang
For that Create two fields (ServerPath and File) and a button (Open associated PDF)

In the button have this script
===============================
Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim note As NotesDocument
     
     Dim hwnd As Long 'the windows handle dont need to initalize
     Dim lpOperation As String
     Dim lpFile As String
     Dim lpParameters As String
     Dim lpDirectory As String
     Dim nShowCmd As Long
     Dim Hwin32 As Long 'the windows target handle dont need to initalize
     
     Set note =  ws.CurrentDocument.Document
     
     'Initialize the vars
     lpFile = note.File(0) 'file name
     lpDirectory = note.ServerPath(0) 'file location
     nShowCmd = 1 'Show the open file
     lpOperation = "Open" 'if you want to print the file change to "Print"
     'and finally execute the file
     If lpFile <> "" And lpDirectory <> "" Then
          Hwin32 = ShellExecute(hwnd,lpOperation,lpFile,"",lpDirectory,nShowCmd)
     End If
End Sub

In the global declarations of the form
=======================================
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (Byval hwnd As Long, Byval lpOperation As String, Byval lpFile As String, _
Byval lpParameters As String, Byval lpDirectory As String, Byval nShowCmd As Long) As Long

For running API you need Windows OS (as this script uses WIN32 API)

UNC - Universal Naming Convention ( what that means is that you can refer any server over network that is sharing directory with this format \\ServerName\Share)

Replication should not be a problem if you store exact server path and file name in a document, To access the server share the user should be on the network.

& this is my emailid: hemanthakumark@bigfoot.com

~Hemanth
Thanks Hemanth,
  that will ease my job. another thing i want to ask . in unc \\server name  means is it a lotus server name or the nt server name. please let me know.
      another is there is any way to find the acrobat reader exe on the local machine . because for different user that might be in the different directory. if the acrobat reader is not installed on the machine is there any way i can use share acrobat reader copy of the network?
thanks,
shrirang
ANOTHER THING I WANT TO ASK OPEN BYREPLICAID WILL OPEN THE DATBASE I DON'T WANT THAT DATABASE TOBE OPEN I WANT TO KNOW WHETHER THE SATBASE IS PRESENT OR NOT

THANKS,
SHRIRANG
\\servername is the name of the NT Server not the domino.

OpenByReplicaID doesn't open the database it checks that if the db can be opened meaning if it exists then open the db in virtual space to access its methods and prop

eg:
Dim db As New NotesDatabase( "", "" )
If db.OpenByReplicaID( "Moscow", "85255FA900747B84" ) Then
  Print( db.Title & " was successfully opened" )
Else
  Print( "Unable to open database" )
End If

Use this updated script in your button.
======================================
Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim note As NotesDocument
     
     Dim hwnd As Long 'the windows handle dont need to initalize
     Dim lpOperation As String
     Dim lpFile As String
     Dim lpParameters As String
     Dim lpDirectory As String
     Dim nShowCmd As Long
     Dim Hwin32 As Long 'the windows target handle dont need to initalize
     
     Set note =  ws.CurrentDocument.Document
     
     'Initialize the vars
     lpFile = note.File(0) 'Describe the file name
     lpDirectory = note.Path(0) 'Describe file location
     nShowCmd = 1 'Show the open file
     lpOperation = "Open" 'if you want to print the file change to "Print"
     'and finally execute the file
     If lpFile <> "" And lpDirectory <> "" Then
          Hwin32 = ShellExecute(hwnd,lpOperation,lpFile,lpParameters,lpDirectory,nShowCmd)
          Select Case Hwin32
          Case 2:
               Msgbox "File Not Found"
          Case 31:
               Msgbox "No helper application available"      ' Remove this later
               lpFile = "notepad.exe"
               lpParameters = note.File(0)
          End Select
          Hwin32 = ShellExecute(hwnd,lpOperation,lpFile,lpParameters,lpDirectory,nShowCmd)
     End If
End Sub

What it does ???

It checks for the file if it doesn't exist then it will prompt "File Not Found"

If there is no helper application then set the helper application and pass the file as parameter to the exe.

Hope this answers all of your questions
& 60 is little less ;-)

Cheers
~Hemanth
Hello Hemanth,
 60 is less for that i will increase it. anothere thing i want to ask if the PDf file is on my local machine. right now there is no proper set up so that i will keep that macine on the local machine. but for testing how can i use the same API for that . please explain me.
Thanks,
shrirang
Hello Hemanth,
 60 is less for that i will increase it. anothere thing i want to ask if the PDf file is on my local machine. right now there is no proper set up so that i will keep that macine on the local machine. but for testing how can i use the same API for that . please explain me.
Thanks,
shrirang
Hi Hemanth ,
  really appreciated. thanks you very much. i tried same thing o my local macine i it was working fine. anothere thing i didin't understand the select statemet you have used. can you expain me little case 31.
  Another thing if the acrobat reader is not avilable on the local machine it is possible to share acrobat reader exe from share location.

thanks,
Shrirang
 

 

Hello Hemanth,
 i tried the print option it is working fine but everytime it prints the 2 copies per page.

Thnaks,
shrirang
Hello Hemanth ,
  is it possible to show only unread documents in the view?

Thanks,
shrirang

Showing unread doc only is not possible

Not sure why it would print 2 pages, unless you setup some copy preference to 2. Because the function doesn't handle number of copies. It is to do with the printer setup

code 31 indicates that there was no app associated with that file to open.

~Hemanth

Hello Hemanth,
  i will check the printer setup. is there any way so that we can check the perticular file on the share drive using dir?
just i want to make sure i want to setup a Lotus notes server. is it necessary to have NT server installed on same machine? because i will keep these share PDF file some where in the network. does it matters to that functionality? please let me know.

Thanks,
shrirang
Hello  Hemanth,
  i tried the print PDf function
  with following parameter it works fine
  ipdirectory  = "c:\shrirang"
  ipfile = "test.pdf

"but my machine name is mvapp136
 so i tried
ipdirectory  = "\\mvapp136\c:\shrirang"
  ipfile = \\mvapp136 \"test.pdf
but it doesn't work.

Please let me know.

we don't have server we have just network. does it matter to this ?

Thanks,
shrirang
sorry i tried
 ipfile = "test.pdf" not "\\mvapp136\test.pdf

thanks,
shrirang
For this you have to do one more thing you have to share the c:\shrirang as public share, right click on the directory that you want to share and give a name "ShareX" and ref like this

ipdirectory  = "\\mvapp136\ShareX"
ipfile = "test.pdf"


The file server can be anything , not necessarily a server where domino is running.


Hello Hemanth,
i am using lotus notes designer . i don't have lotus server. i am developing some standalone application. i have two computers. we have network no server.
   Because of this i can not access the file that are on the other server.
   
   is there any special way i can test the network functionality.

  thanks,
shrirang
 
ASKER CERTIFIED SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Boss,
    Thank you very much i was able to connect to network.
 Because of you i completed my functinality. Another thing i want to ask you is there any book , that will explains all the API ?

By the way where are you working ? you must be in USA ? am i right? if you don't mind could you give me ur Phone number. just i want to say thanks to you.

Thanks you very much.
Shrirang
 
My Email ID shrihalbe@hotmail.com


Bye,
shrirang
Thanks
 Shrirang