I have a MOSS 2007/WSS 3.0 Site that acts as a document repository. There is a search web part that displays results in the form of a grid. Each item has a checkbox, User can select multiple documents of various formats and when they click on a print button, the data from each of these documents must be bulk printed. The printing has to be done at client side and I cannot implement any third party software but need to get this achieved. What is the best solution for this requirement?
I don't know if this will work for 2007, as 2007 has no printing option. You'll need to use the browser printing options that you can access.
You can make a recursive method that calls a new browser to print when opened (same way the browser handles printing).
Create a webpart, webpart needs a button... when clicked it needs to scan the webpage to see what is selected, from that you can create an array that stores all the URLs for selected documents, now loop through each selected array item and passing the URL to this method:
private void PrintHelpPage(string UrlDocument)
// Create a WebBrowser instance.
WebBrowser webBrowserForPrinting = new WebBrowser();
// Add an event handler that prints the document after it loads.
// Set the Url property to load the document.
webBrowserForPrinting.Url = new Uri(@UrlDocument);
private void PrintDocument(object sender,
// Print the document now that it is fully loaded.
// Dispose the WebBrowser now that the task is complete.
UrlDocument is the URL your passing from within the array loop that you're iterating through!
I don't know if it's just going to run through all at once populating the print spool (shows multiple opened browsers) or one at a time! My guess is all at once but they should close as soon as the command is sent to the print spool.
Or you can loop through the controls within a page, check to see if the checkbox control is checked and pass the value... this will loop through all checked items.
private void btnAdd_Click(object sender, EventArgs e)
foreach(Control c in Page.Controls)
if (c is Checkbox)
CheckBox cb = c as CheckBox;
if (cb.Checked == true)
The code above won't work as it got some mistakes but it's almost there to work as you want! I'm sure the checkbox text is not the value but the above code will show you how to go about doing it. Or, as I said, do it through an array looping through within the same method above (click event).
The best you're going to be able to do is to just get the collection of URLs of the selected files and call
window.open() on all of them. Due to the nature of the web, and the security involved in keeping things safe, the browser has very little control over the application once it has opened.
You could use ActiveX, but you can only deal with Office documents, and the user has to be using 32bit IE, with the URL of the web app in the Local Intranet zone, and the web app has to be using Windows Auth.