.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Print button on InfoPath form

Posted By:Jean Paul       Posted Date: October 30, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we will learn a scenario of showing Print button on InfoPath forms.
 

In this article we can explore a real-life scenario to show a Print button on an InfoPath form in view/edit mode. You can also extend the solution to other list forms.

Why Print button needed on forms?

By default there is no print button on SharePoint forms.

clip_image002

Steps

Following are the steps needed to achieve the Print button solution. We are using HTML & JavaScript for the solution.

Step 1: Enable Modeless forms

By default the view/edit forms are opened in dialog forms. We need to change this to edit the page.

Choose List > List Settings > Advanced Settings

clip_image004

Set the last option to No.

Now you can see the View form is opened in full page mode.

clip_image006

Following is the Edit form.

clip_image008

Step 2: Edit Page

Open a list item in View Form, Choose the Site Actions > Edit Page option to bring the page to edit mode. Add a Content Editor Web part & enter the following HTML contents.

<input onclick="window.print();" type="button" value="Print"/>

clip_image010

Click OK to save the changes. Choose Stop Editing from the page tab. The page will look like below.

clip_image012

We added a Print button which will invoke window.print() method on click.

Step 3: Test the page

Refresh the list & open a list item in View Page. Click on the Print button & you can see the Print Dialog appearing like below.

clip_image014

This confirms the print functionality integration. You can also repeat the same for Edit form.

Step 4: Enable back dialog

Now we need to enable back the dialog form. Go to List Settings > Advanced Settings & enable the Dialog option.

clip_image016

You can see the Print button there too.

clip_image018

The print() method prints the contents of the current window.

Custom Action

For having a custom action you can refer the solution below:

http://infopathprinter.codeplex.com/

clip_image020

References

http://www.w3schools.com/jsref/met_win_print.asp

Summary

In this article we have explored a scenario of showing Print button on InfoPath forms.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend