Print a form from a button - InfoPath Dev
in

InfoPath Dev

Print a form from a button

Last post 04-01-2015 12:16 AM by Jedzbatz. 20 replies.
Page 1 of 2 (21 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-27-2009 12:09 PM

    • DavidSea2
    • Not Ranked
    • Joined on 03-06-2009
    • West Palm Beach, FL
    • Posts 14

    Print a form from a button

    Is is possible to set up a button that will print the form?  I have created a print view.

    David
  • 03-27-2009 12:14 PM In reply to

    Re: Print a form from a button

    Hello David,

    As far as I know, there is a rule that allows you to switch views codelessly, but there is no rule to allow you to print.

    You can create a button that can switch views, then the users can select File > Print.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-27-2009 12:24 PM In reply to

    • DavidSea2
    • Not Ranked
    • Joined on 03-06-2009
    • West Palm Beach, FL
    • Posts 14

    Re: Print a form from a button

    Thanks Ernesto - That is exactly what I did, but my users complained.  I guess I was hoping that someone with coding skills had code that would do it.

    Thanks again

    David
  • 03-27-2009 02:11 PM In reply to

    Re: Print a form from a button

    Hi -- it is possible to do this, but your form has to be full trust. Are you using IP 2003 or 2007? Is having your form be full trust an issue? This thread has some information as well.

    Hilary Stoupa

  • 03-31-2009 07:02 AM In reply to

    • DavidSea2
    • Not Ranked
    • Joined on 03-06-2009
    • West Palm Beach, FL
    • Posts 14

    Re: Print a form from a button

    Good Morning Hilary - Thnaks for taking time to help me - I'm a very Newbie, I don't understand Full Trust, it doesn't sound like I have a problem with it, since I'm on a federal intranet, so I trust all of my users. I'm on 2003. I played with that code for a couple of hours yesterday and kept getting this error:  InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    Expected ';'
    File:script.js
    Line:24
    {Dim msg As String Dim title As String Dim style As

    I have no programing training

      If you have the time - Do you have any ideas what I'm doing wrong?

     Again thanks for your help.

     David

     

     

    David
  • 03-31-2009 09:39 AM In reply to

    Re: Print a form from a button

    Full Trust isn't so much about whether you trust your users ... it is a security setting for the form. Looks like you copied VB code in but your form is set to use jscript -- So, add your button, and select to edit code for it. When the script window opens add this line where it says //Write your code here:

    XDocument.PrintOut();

    When you preview the form and try to use the button, you'll probably get an error telling you 'Permission denied'. You'll need to change the security under the Form Options to Full Trust. This MSDN article has more information, but it might be a little on the geeky side -- the original post I pointed you to also has some information.

    Hilary Stoupa

  • 04-21-2010 12:33 AM In reply to

    Re: Print a form from a button

    Hi Hilary,

    I've been trying to add the print button in IP 07 but I can't get it operational. IP keeps incisting that there is a fault in the code, and therefore it cannot excecute the action (or something like that).

    The code I've inserted is

    "function CTRL1206_5::OnClick(eventObj)
    {
    XDocument.PrintOut(); // Write your code here
    }"

    (the " aren't actually in the code)

    Now this makes me feel like such an ass (the donkey, not the buttox), because I read everyone's messages sayin that it's SO easy, yet I can't get it operational,

    Could you please help me?

    Thanks a milion!

    Bart

  • 04-21-2010 12:50 AM In reply to

    Re: Print a form from a button

    try

    this.Print();

    Print functionality is avaibale only for client forms, it is not avaiable in browser enabled forms

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-21-2010 01:05 AM In reply to

    Hi Qazi,

    Thanks for the suggestion, but it still doesn't work :(

    I'm not sure if it is a client form of a browser enabled form, but I think it's a client form (infopath opens templates from a sharepoint library locally.

     

    Regards,


  • 04-21-2010 01:37 AM In reply to

    Re: Print a form from a button

    in the function

    use

    this.Print();

    instead of

    XDocument.PrintOut();

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-21-2010 02:02 AM In reply to

    Re: Print a form from a button

     Hi Qazi,

    When I try the button in preview mode, I still get the message that IP could not execute because there is an arror in the form template...

    Thanks anyway!

    Regards

  • 04-21-2010 02:22 AM In reply to

    Re: Print a form from a button

    go to form template

    tools -> options -> comaptibility -> uncheck Design a form template that can be opened in a browser or infopath

    and then try previewing the form

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-21-2010 02:34 AM In reply to

    Re: Print a form from a button

    I probably have some sort of super-duper King of all Infopaths installed... The box was unchecked when I looked.
  • 04-21-2010 04:12 AM In reply to

    Re: Print a form from a button

    what version of infopath are you having installed on your machine. is it infopath 03, 07 or 2010

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-21-2010 04:48 AM In reply to

    Re: Print a form from a button

     I'm currently using infopath2007

Page 1 of 2 (21 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.