This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.

May 18, 2017, 1:46 PM
69 Posts

how to print all docs in a folder

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2

I'm working on a way to print documents that are selected in a view panel in xPages.  So far, I've come up with a button to get the selected documents and put them in a folder.  But then how do I print all the documents in a folder?  I want to print the entire document, not just what's displayed in the view panel.

May 18, 2017, 3:06 PM
122 Posts
Print all docs in a folder

You can only print what is visible to the browser. So you need to design that layout. Depending on size, you may want to handle page breaks - standard CSS will allow you to do that (there are plenty of examples on the internet, e.g.

Once you have a layout, you need to repeat it for each document selected. That's precisely what the Repeat Control is for It's basically a "for" loop iterating over the collection passed into the repeat control and generating the HTML for each element in the collection). You'll be able to skip the step of putting documents in a folder. Because to put them in the folder, you've got a collection of UNIDs or NoteIDs. Once you've got a collection of UNIDs or NoteIDs, you can use that as the source for the Repeat Control (value property, var will give you each element in the collection, i.e. each UNID; set rows property to more than can be selected, so you get everything). Within the repeat control, you can then have a dominoDocument datasource computing the documentId property and ensuring you've set ignoreRequestParams="true" (no point setting documentId and leaving the risk of it using the URL for the documentId).

Put this on its own XPage, in your button store the collection on UNIDs in sessionScope so you can pass it across (you can't store the documents themselves because Domino objects can't be stored in scoped variables), then launch that XPage with the repeat control on it.

I'm not sure of the level of your experience with XPages, so you may already be very comfortable with what I've explained. If not, I've tried to explain conceptually what's happening, because the understanding is significantly more important than just the final code. If this sounds complex for you, I would strongly recommend persevering and getting your head around it. It will give you experience that will be extremely reusable and vastly enhance the potential of your XPages applications.

May 18, 2017, 3:31 PM
69 Posts

Thanks Paul!  I've been working with xPages for several years now, so I'm pretty comfortable with it.  I already have the collection of IDs in my button, so I'll give this a shot with a repeat control.

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.