April 8, 2011

// // 4 comments

Add print Button in Infopath form


To add print button in infopath form ...

1.Right click the print button ->Button Properties->Edit Form Code. It will open Visual Studio Tools for Applications (VSTA)

2. Add the following code for that print button.


PrintDocument pd = new PrintDocument();
pd.Print();

3.Also add the following namespaces.



using System.Drawing;
using System.Drawing.Printing;


NOTE:
This will not work in Browser enabled infopath forms



4 comments:

  1. how/where do you add the namespaces you describe?

    ReplyDelete
  2. Hi jasper mole,

    In the top... below the default namespaces..

    ReplyDelete
  3. Hmm not able to get this to work. For us non-programmers a glimpse of the final code work be really helpful.

    ReplyDelete
  4. NOTE: This only works on pre-InfoPath 2013. v2013 does not have the ability to natively add code w/o owning Visual Studio pro.

    ReplyDelete