Printing

Hi,Our client requirement is hide the print option available in file and provide printing button to some specific person.

I solved this problem but whenever i print the document it print in first time but second time it gives error"document command is not available".If i closed the database it again work properly.

while i used edit mode also.I am also provide sciripting i have been used.

Plz help me.

Sub Click(Source As Button)

Dim ws As New NotesUiWorkspace

Dim uidoc As notesuidocument

Dim udoc As NotesDocument

Dim uiview As NotesUIView 'change

Set uiview = ws.Currentview

Set uidoc = ws.CurrentDocument

uidoc.EditMode=True

uidoc.AutoReload = True

Set udoc = uidoc.Document

Call udoc.ReplaceItemValue("$KeepPrivate","0")



Call uidoc.fieldsettext("ButtonClicked","1")

uidoc.EditMode=True

'Call uiview.Print

'Call uidoc.Print

Call udoc.Save(True,False)

Call uidoc.Print(1,0,0,False)

'Call uidoc.Print

uidoc.AutoReload = True

Call udoc.ReplaceItemValue("$KeepPrivate","1")

Call uidoc.fieldsettext("ButtonClicked","1")

Call uidoc.save

Call udoc.Save(True,False)

Call uidoc.close	

End Sub

Thanx & Regards

Sonal Singh

Subject: Printing

Did you copy your code?if so this line:

Call udoc.ReplaceItemValue(“$KeepPrivate”,“1”)

should be uidoc instead of udoc.

If not, have you stepped through with the debugger?

If so where does it fail?

Subject: Printing

I don’t know what your problem is – probably something having to do with when Notes looks at the value of the $KeepPrivate flag – but it’s a bad idea to keep modifying and saving the document just to make it print. It causes unnecessary view re-indexing and replication delays, and makes it extremely likely you’ll get replication conflicts.

Maybe you could design the form so that if it is opened with a particular field value set (e.g. PrintMe = 1), it prints itself and then closes. Then you could just modify the document in memory (setting $KeepPrivate and PrintMe), open it in a dialog to cause the printing, and reset the fields to their previous values, without ever saving the document.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

For faster answers, be C R I S P Y