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

Top 5 Contributors of the Month

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.



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


Set the last option to No.

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


Following is the Edit form.


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"/>


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


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.


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.


You can see the Print button there too.


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

Custom Action

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






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

 Subscribe to Articles


Further Readings:


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