in

InfoPath Dev

Creating a 'Print' Button or printing on submit

Last post 09-25-2008 06:16 PM by phamj. 5 replies.
Page 1 of 1 (6 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 200 Contributor
      Female
    • Joined on 05-22-2008
    • Australia
    • Posts 23

    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?

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