Creating a 'Print' Button or printing on submit - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Creating a 'Print' Button or printing on submit

Last post 03-28-2012 12:00 PM by NWFTC. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-03-2006 02:10 AM

    Creating a 'Print' Button or printing on submit


    Is it possible to insert a button (like a submit one) but get it to print on pressing it as opposed to submitting to the database (sharepoint in my case).

    I found a similar thread where somone wanted to print after it was submitted which would also be an option.

    On this post the following code was suggested but what do I do with it and where would I put it?

    thisXDocument.PrintOut();

    I tried just creating a button and pasting this code in to rules code but it doesn't do anything, is there a special way the above is supposed to be implemented? (am using JS btw).

    Thanks!

    My form is now doing everything I want it to and this is the last hurdle before I can start using it live.
  • 01-03-2006 03:00 AM In reply to

    • Nagesh
    • Not Ranked
    • Joined on 07-21-2005
    • India
    • Posts 5

    Re: Creating a 'Print' Button or printing on submit

    Hi Julie-mids,

    You can follow these steps for that,

    1) Paste “thisXDocument.PrintOut()” under the code of Print button you placed.
    2) Give full trust to your form and sign it.
    3) Now publish the form either to sharepoint or localdirectory.
    4) Open the published form and click that Print button .
    5) A dialog will be displayed asking you to save that file with an extension “mdi”.
    6) Click on save and you will see the print preview of that form.
    7) You can now do whatever you want regarding printing.

    I think this would work for you,

    Thanks

    Nagesh
    InfoPath Dev India
  • 01-03-2006 03:19 AM In reply to

    Re: Creating a 'Print' Button or printing on submit

    Hia Nagesh,

    When I paste that code into the Rules Code of the button I get the following error:

    'thisXDocument' is undefined
    File:script.js
    Line:718


    Is there some way this code should be inserted (ie: with some syntaxes before or after it)? I have literally just pasted that in the code as it stands.
  • 01-03-2006 03:29 AM In reply to

    • Nagesh
    • Not Ranked
    • Joined on 07-21-2005
    • India
    • Posts 5

    Re: Creating a 'Print' Button or printing on submit

    Hi julie,

    You please put "XDocument" in place of "thisXDocument" in that button code and follow the same process.

    Thanks

    Nagesh
    InfoPath Dev India
  • 01-03-2006 04:12 AM In reply to

    Re: Creating a 'Print' Button or printing on submit


    Nagesh, you are Wonderful... It Works! Many Thanks x

    For anyone else needing this, you need to give the form full trust first by selecting the Form Option tab under the tools menu. Select Full Trust under the security tab and then use the 'create certificate' to give yourself a digital signature.

    Right, now on to my next question lol ..will go do a search first though ;-)
  • 09-25-2008 06:16 PM In reply to

    • phamj
    • Top 500 Contributor
      Female
    • Joined on 05-23-2008
    • Australia
    • Posts 26

    Re: Creating a 'Print' Button or printing on submit

    5) A dialog will be displayed asking you to save that file with an extension “mdi”.
    6) Click on save and you will see the print preview of that form.
    7) You can now do whatever you want regarding printing.

     

    The steps 5-7 did not appear for me. Though the form printed successfully.  

    I would like a print preview button just like the one on top of the toolbar but however on the form instead.  Help?

  • 01-23-2009 03:00 AM In reply to

    Re: Creating a 'Print' Button or printing on submit

    Dim msg As String Dim title As String Dim style As Microsoft.VisualBasic.MsgBoxStyle Dim response As Microsoft.VisualBasic.MsgBoxResult msg = "Print this Document " style = Microsoft.VisualBasic.MsgBoxStyle.DefaultButton1 Or Microsoft.VisualBasic.MsgBoxStyle.OkOnly title = "Print Document" response = Microsoft.VisualBasic.MsgBox(msg, style, title) If response = Microsoft.VisualBasic.MsgBoxResult.Yes Then Me.Print() End If this is the code used to print the infopath form with a information to the user. i think it may help others. thank you
  • 08-09-2010 04:06 AM In reply to

    Re: Creating a 'Print' Button or printing on submit

    Hi, Could you tell me please, how can ı reach code behind of button, which i put on the sharePoint list or form of InfoPath? thank you :)
  • 10-21-2010 03:37 AM In reply to

    Re: Creating a 'Print' Button or printing on submit

    Hi All,

    Can we achieve without code (at least without form behind code)?

    Can't we configure some rules or write javascript to achieve this? 

    Thanks,

    Rahul Babar

    ================================================
    ASP.NET, C#, Sharepoint 2007/2010, Infopath 2007/2010 Developer
  • 03-28-2012 12:00 PM In reply to

    • NWFTC
    • Not Ranked
    • Joined on 02-15-2012
    • Posts 19

    Re: Creating a 'Print' Button or printing on submit

    HI Nagesh

    Seen your text on print button but i have no idea how to put code into a button, can you tell me how

Page 1 of 1 (10 items)
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.