Saturday, December 31, 2011

Import image resources via LotusScript & Java

People have created various versions where you can import image resources in a NSF database using LotusScript. Basically you mimic the functionality of "Import Image Resource" button present in Domino Designer via code.


Some of the examples can be found here and here. Here is my version of doing this same thing using combination of LotusSciript & Java with LS2J.


First, download the ZIP file for Apache Commons Codec. For this example I am using Apache Commons Codec 1.4. Extract the downloaded zip file on to local file system. Then include the jar file "commons-codec-1.4.jar" in the database in a Java script library.


Create a class inside the script library, say ApacheCommons. Put the following code in it:


Now create an agent in LotusScript and put the following code in it:


Run this agent from Actions menu in Lotus Notes client to import image resource.

2 comments:

  1. Replies
    1. You would have to convert the LotusScript code to Java and then call it from XPages, probably SSJS code. It would be a bit tricky as image would have to be uploaded via browser and processed, but its certainly doable.

      Delete