Print picture alone and not the form - InfoPath Dev
in

InfoPath Dev

Print picture alone and not the form

Last post 01-10-2011 08:54 PM by warrtalon. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 12-31-2010 04:43 AM

    Print picture alone and not the form

    Hi,

    I am using Infopath filler 2010. I have added a 2 textbox, button and a picture tool.

    The button is used for printing the picture.

    This is the code i have used;

    [CODE]

     if (this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Image1", this.NamespaceManager).Value != string.Empty)

    {

    this.Print(true);

    }

    [/CODE]

    But this is printing the whole form. How to print the Image alone.

    Thank you

  • 12-31-2010 05:57 AM In reply to

    Re: Print picture alone and not the form

    Hi, you can make a view with just your image and make a switch view just before the print.

  • 01-01-2011 03:22 AM In reply to

    Re: Print picture alone and not the form

    Hi,

    Thank you very much for the reply. Wishing you a very Happy New year

    I am very new to Infopath. I have a button on the Default view page, which is called Print.

    In the View toolbar available in Infopath designer, i created a new view, named it "PrintView". Added a Picture tool in it.

    How to switch to the "PrintView" on the click of the button.

    I tried this in the button click:

    [CODE]

     public void BtnPriint_Clicked(object sender, ClickedEventArgs e)
            {    
                XPathNavigator xnDocument = this.MainDataSource.CreateNavigator();
               
                XPathNavigator xnDefaultView = xnDocument.SelectSingleNode("/my:myFields/my:Image1", this.NamespaceManager);

                //Image1 is the name of Picture tool available in the Default View
                 if (this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Image1", this.NamespaceManager).Value != string.Empty)
                 {                   
                    if ((xnDefaultView != null) && (xnDefaultView.Value != ""))
                    {
                        //Switch to the appropriate View
                        switch (xnDefaultView.Value)
                        {
                            case "false":
                                e.SetDefaultView("View 1");
                                break;

                            case "true":
                                e.SetDefaultView("PrintImageView");
                                //Image2 is the Name of the Picture tool available in the Newly created View
                                 if (this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Image2", this.NamespaceManager).Value != string.Empty)
                                 {
                                        this.Print(true);              
                                 }            
                                break;
                    }
                }
            }               
            }

    [/CODE]

    I am getting the error as 'Microsoft.Office.InfoPath.ClickedEventArgs' does not contain a definition for 'SetDefaultView'

    And, i am not sure of how to move the picture which is available in the first view to the second view.

    How to achieve this?

    Thank you

  • 01-01-2011 08:13 AM In reply to

    Re: Print picture alone and not the form

    hi happy new year you too.To switch view, the command is not e.SetDefaultView but this.ViewInfos.SwitchView("PrintImageView");
  • 01-03-2011 04:55 AM In reply to

    Re: Print picture alone and not the form

    Hi,

    As i need to use the page offline with sharepoint workspace, i now selected the "SharePoint list" as template. Here, i am not able to do any coding part. Is it possible to print the image alone, using rules?

    Thank you

  • 01-05-2011 06:59 AM In reply to

    Re: Print picture alone and not the form

     

    Hi, the switch part you can do it by rules, but the print one not really. But what is your coding problem?
  • 01-10-2011 08:44 PM In reply to

    Re: Print picture alone and not the form

    Hi,

    I had selected the Sharepoint list template, so i am not having the developer tab. so, I am not sure, where to code.

    Thank you

  • 01-10-2011 08:54 PM In reply to

    Re: Print picture alone and not the form

    Edit: I see you later changed to a list template.  You cannot add code to list form templates.

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