Wednesday, March 2, 2016

Lotus notes view ReadViewEntries

I just tested an ajax function in notes and I thought of constructing a view based on the json in lotus notes native web/ Xpages.

I have passed the view?ReadViewEntries in the ajax call. But I got only 10 viewentries instead of 1000. After that I just walk around the blogs of notes expert, I found the nice article, I am sharing in below,

http://macguidera.blogspot.com/2006/08/readviewentries.html

Thanks for the above post...

Wednesday, June 24, 2015

Convert the NotesDocument into PDF

Here is the interesting stuff comes again, I need to convert all the documents into pdf file. I started my research on that, initially I thought it was easy because I have already worked on that but last time I did not handle/ convert Rich Text item. Creating table, designing the PDF template all are very easy. But getting the handle of inline images in Rich Text Item is very difficult, if you do not want to spend money.

 I have done my design using itext.jar, and created my own PDF template for document. Now I captured all the infos like Text, Text List, Date/Time, Names and etc., except RTF and RT lite field.

 I started to work on attach the file into pdf, started with hard but ended with very easy. I extracted file from RTF and saved in the local machine temp folder and attached into the PDF. Thanks a lot to iText.jar.

             RichTextItem rt = (RichTextItem)  doc.getFirstItem("Body");
              Vector ve = rt.getEmbeddedObjects();
              EmbeddedObject eo = null;
           Enumeration e = ve.elements();
           if(ve.size() > 0)
           {
            attachments = new String[ve.size()];
               while (e.hasMoreElements()) {
                eo = (EmbeddedObject)e.nextElement();
                eo.extractFile("C:\\Temp\\" +eo.getSource());
                attachments[count] = "C:\\Temp\\" +eo.getSource();
                  }
           }
Code for attaching the file into PDF file... The below is not from my knowledge it is taken from one blog, I forgot because long back I have taken this piece of code. Sorry and don't mind :D

public void addAttachments(
 String src, String dest, String[] attachments) throws IOException, DocumentException {
 PdfReader reader = new PdfReader(src);
 PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
 for (int i = 0; i < attachments.length; i++) {
   addAttachment(stamper.getWriter(), new File(attachments[i]));
 }
 
 stamper.close();
}

protected void addAttachment(PdfWriter writer, File src) throws IOException {
 PdfFileSpecification fs =
   PdfFileSpecification.fileEmbedded(writer, src.getAbsolutePath(), src.getName(), null);
 writer.addFileAttachment(src.getName().substring(0, src.getName().indexOf('.')), fs);
}
Once everything is set I have entered into the tough task, that is converting the inline image to attachment/ embed the same image in PDF file. Both are difficult.


  1. I just gone through the PDF creator class and convert the document into pdf file like Prrint -> Save as PDF using PDF creator tool. But the result, I faced so many difficulties, somemachine adopt the code and close the PDF file, many machine can not close the PDF object so my notes gets crashed. So I do not want to go with PDF creator. For this PDF creator needs to be installed on your PC.
  2. I just googled and found that midas is the lotus script library, it is good but it is not free software. 
  3. I just found many automated tools like swing PDF converter, etc., but it is quite expensive. I do not want to spend money on that. 
  4. I have gone through many blogs and discussion portals. I could not find the proper code for that.
Finally I just created webpage for my application, we have many easy tool for converting the HTML page to PDF. I just converted the Notes HTML document to PDF file, and extract the attachment and saved it in local folder. I embedded the attachment into the above pdf file. I have reached my goal, I do not think it is good and efficient.

Still my research on handling the inline image of RTI is going on, :( :( :(



Thursday, May 23, 2013

Read the XML in Lotus Notes

Really very hard to understand the structure of the Notes XML parsing classes. Still I need to understand more. Actually I tried to read the xml file for some requirement.

Initially I thought it is an easy job but after an half of the day had gone, I realized it is difficult one.

If someone has nice trick please share to me...

    Dim session As New NotesSession
    Dim domparser As NotesDOMParser
    Dim domdoc As NotesDOMDocumentNode
    Dim domlist As NotesDOMNodeList
    Dim domlist1 As NotesDOMNodeList
    Dim domele As NotesDOMElementNode
    Dim stream As NotesStream
    Dim node As NotesDOMNode
    Dim node1 As NotesDOMNode
    Dim x As String   
    x= "D:\javap\Test.xml"
    Set stream = session.CreateStream()
    stream.open(x)
    Set domParser = session.CreateDOMParser(stream)
    domParser.Process
    Set domdoc = domparser.Document
    Set domele = domparser.Document.DocumentElement
    Set domlist = domele.GetElementsByTagName("TagName")
    Set node =  domlist.GetItem(1)
    Msgbox node.FirstChild.NodeValue
 

Monday, May 20, 2013

Windows Run Command

For lazy users like me, sometime our job will be get bored because we need to do the same job for as many time. Also we need to interact with the windows frequently. Probably we can create macro or agent for doing the particular job for as many times. However we can not do this for all cases. The below are the interesting stuff. These are the Run Commands in windows. I hope this will be very useful. I found this in the following site...

-Useful-Run-Commands
To Access…Run Command
Accessibility Controls access.cpl
Accessibility Wizardaccwiz
Add Hardware Wizardhdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Toolscontrol admintools
Adobe Acrobat (if installed)acrobat
Adobe Designer (if installed)formdesigner
Adobe Distiller (if installed)acrodist
Adobe ImageReady (if installed)imageready
Adobe Photoshop (if installed)photoshop
Automatic Updateswuaucpl.cpl
Bluetooth Transfer Wizardfsquirt
Calculatorcalc
Certificate Managercertmgr.msc
Character Mapcharmap
Check Disk Utilitychkdsk
Clipboard Viewerclipbrd
Command Promptcmd
Component Servicesdcomcnfg
Computer Managementcompmgmt.msc
Control Panelcontrol
Date and Time Properties timedate.cpl
DDE Shares ddeshare
Device Managerdevmgmt.msc
Direct X Control Panel (if installed)*directx.cpl
Direct X Troubleshooterdxdiag
Disk Cleanup Utilitycleanmgr
Disk Defragmentdfrg.msc
Disk Managementdiskmgmt.msc
Disk Partition Managerdiskpart
Display Propertiescontrol desktop
Display Propertiesdesk.cpl
Display Properties (w/Appearance Tab Preselected)control color
Dr. Watson System Troubleshooting Utilitydrwtsn32
Driver Verifier Utilityverifier
Event Viewereventvwr.msc
Files and Settings Transfer Toolmigwiz
File Signature Verification Toolsigverif
Findfastfindfast.cpl
Firefox (if installed) firefox
Folders Propertiesfolders
Fontscontrol fonts
Fonts Folderfonts
Free Cell Card Gamefreecell
Game Controllers joy.cpl
Group Policy Editor (XP Prof)gpedit.msc
Hearts Card Gamemshearts
Help and Supporthelpctr
HyperTerminalhypertrm
Iexpress Wizardiexpress
Indexing Serviceciadv.msc
Internet Connection Wizardicwconn1
Internet Exploreriexplore
Internet Properties inetcpl.cpl
Internet Setup Wizardinetwiz
IP Configuration (Display Connection Configuration)ipconfig /all
IP Configuration (Display DNS Cache Contents)ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents)ipconfig /flushdns
IP Configuration (Release All Connections)ipconfig /release
IP Configuration (Renew All Connections)ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS)ipconfig /registerdns
IP Configuration (Display DHCP Class ID)ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID)ipconfig /setclassid
Java Control Panel (if installed)jpicpl32.cpl
Java Control Panel (if installed)javaws
Keyboard Propertiescontrol keyboard
Local Security Settingssecpol.msc
Local Users and Groupslusrmgr.msc
Logs You Out Of Windows logoff
Malicious Software Removal Tool mrt
Microsoft Access (if installed)msaccess
Microsoft Chatwinchat
Microsoft Excel (if installed)excel
Microsoft Frontpage (if installed)frontpg
Microsoft Movie Makermoviemk
Microsoft Paintmspaint
Microsoft Powerpoint (if installed)powerpnt
Microsoft Word (if installed)winword
Microsoft Syncronization Toolmobsync
Minesweeper Gamewinmine
Mouse Propertiescontrol mouse
Mouse Propertiesmain.cpl
Nero (if installed)nero
Netmeeting conf
Network Connectionscontrol netconnections
Network Connectionsncpa.cpl
Network Setup Wizardnetsetup.cpl
Notepadnotepad
Nview Desktop Manager (if installed)nvtuicpl.cpl
Object Packagerpackager
ODBC Data Source Administratorodbccp32.cpl
On Screen Keyboardosk
Opens AC3 Filter (if installed)ac3filter.cpl
Outlook Expressmsimn
Paintpbrush
Password Propertiespassword.cpl
Performance Monitorperfmon.msc
Performance Monitorperfmon
Phone and Modem Options telephon.cpl
Phone Dialerdialer
Pinball Gamepinball
Power Configuration powercfg.cpl
Printers and Faxescontrol printers
Printers Folderprinters
Private Character Editoreudcedit
Quicktime (If Installed)QuickTime.cpl
Quicktime Player (if installed)quicktimeplayer
Real Player (if installed)realplay
Regional Settings intl.cpl
Registry Editorregedit
Registry Editorregedit32
Remote Access Phonebookrasphone
Remote Desktop mstsc
Removable Storagentmsmgr.msc
Removable Storage Operator Requestsntmsoprq.msc
Resultant Set of Policy (XP Prof)rsop.msc
Scanners and Camerassticpl.cpl
Scheduled Taskscontrol schedtasks
Security Center wscui.cpl
Servicesservices.msc
Shared Foldersfsmgmt.msc
Shuts Down Windowsshutdown
Sounds and Audio mmsys.cpl
Spider Solitare Card Gamespider
SQL Client Configuration cliconfg
System Configuration Editorsysedit
System Configuration Utilitymsconfig
System File Checker Utility (Scan Immediately)sfc /scannow
System File Checker Utility (Scan Once At The Next Boot)sfc /scanonce
System File Checker Utility (Scan On Every Boot)sfc /scanboot
System File Checker Utility (Return Scan Setting To Default)sfc /revert
System File Checker Utility (Purge File Cache)sfc /purgecache
System File Checker Utility (Sets Cache Size to size x)sfc /cachesize=x
System Informationmsinfo32
System Properties sysdm.cpl
Task Managertaskmgr
TCP Testertcptest
Telnet Clienttelnet
Tweak UI (if installed)tweakui
User Account Managementnusrmgr.cpl
Utility Managerutilman
Windows Address Bookwab
Windows Address Book Import Utilitywabmig
Windows Backup Utility (if installed)ntbackup
Windows Explorerexplorer
Windows Firewallfirewall.cpl
Windows Magnifier magnify
Windows Management Infrastructurewmimgmt.msc
Windows Media Playerwmplayer
Windows Messengermsmsgs
Windows Picture Import Wizard (need camera connected)wiaacmgr
Windows System Security Toolsyskey
Windows Update Launcheswupdmgr
Windows Version (to show which version of windows)winver
Windows XP Tour Wizardtourstart
Wordpad write

Wednesday, February 27, 2013

How do we find the size of a rich text field in Lotus Notes?

I am facing an issue, Its peculiar but still IBM is not fixed this issue,

My database is very old. It is created on 1998. Now my database's version is 6.5.1. So my case everything has its own limit. After a long time, I seen like my db usage is 98% after the completion of compacting. So whenever my document exceeds 32K it can be old or new, the document became spam. Like we can not access the document. We can not open the document. We can not see the property of the document. I had some agents that will take all the documents one by one. Because of this issue, the agent stopped and thrown the error like "field is too large 32k or view's column & selection formulas are too large". I could not find the reason why it is happening.

eg:- If my already existing document has more than 32k of size. I have gone and edited the document. And saved it. The document size exceeds 32k, and it became spam what I mentioned above. If my new document exceeds 32k, I attained the same issue.

I was confused. I tried the following steps.

1. I changed the Text to Summary for all items. Nothing happened.
2. As of Notes constraints, document can have any number of size less than 64GB(about db size). But less than 6 It has some limitation. I guess. Sorry if it is wrong. Number of field should not exceed 3000. So I checked the document size. And tried to reduce that. I deleted contents of the fields and made the document to less than 64K. Same problem came.
3. I created a lot of field. The form had thousands of field. So I removed many field. I counted as a child and made it to 1000 exactly including reserve fields. Like $Revisions.  -  32K error. :(
4. I know that the limitation of RTF(Rich Text Field)  is 1gb. So I ignored.
5. I found the $UpdatedBy field is exceeding 32K of size. So I limited the number of entries for this.





Finally, I found that the issue from Rich text field. I deleted the attachments and reduced the document size less than 32k. and saved it. I got satisfied.

So I planned to restrict the document size to the user. I want to avoid the 32K error in future documents. Better I can stop the attachment size should not exceeds 15k. So I want to fetch the size of the RTF. I found the better solution for that. t refers NotesRichTextItem.

        Set t = doc.GetFirstItem("body")
Dim newdoc As NotesDocument
Set newdoc = db.CreateDocument()
Call t.Copyitemtodocument(newdoc, "reasonType")
Msgbox newdoc.Size

Also I can count the current document size. One funny thing is, our Notes rich text field contents like copy and pate images not an attachments can not be taken without saving the document.


Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim t As Variant
Call uidoc.FieldSetText("SaveOptions","0")
Call uidoc.Save()
uidoc.Refresh
Set db = session.CurrentDatabase
Set doc = uidoc.Document
        msgbox doc.size

But my question to IBM, Why the hell this much big issue can not be solved?

Once the 32K error document has been created then we have to delete the replica copy and take a new replica copy from the source server. This is the only solution for deleting the 32K error documents. You can not delete these document manually.