<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/78541.aspx</link><pubDate>Sun, 13 May 2012 05:59:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78541</guid><dc:creator>swamy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78541.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=78541</wfw:commentRss><description>&lt;p&gt;HI Shiraz,&lt;/p&gt;
&lt;p&gt;I have a simillar requirement &amp;quot;There is one InfoPath form with 4 views,&amp;nbsp;One button&amp;nbsp;on main default view,&amp;nbsp;When user clicks on the this button, need to export all other views to PDF file.&lt;/p&gt;
&lt;p&gt;Tried using below code &lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CTRL2_6_Clicked(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ClickedEventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ViewInfoCollection&lt;font size="2"&gt; viewInfos = ViewInfos;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ViewInfo&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; thisView &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; viewInfos)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.ViewInfos.SwitchView(thisView);&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;.CurrentView.Export(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;@&amp;quot;d:\this&amp;quot;+&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;.CurrentView.ViewInfo.Name&lt;/font&gt;&lt;/font&gt;+&amp;quot;.pdf&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ExportFormat&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;.Pdf);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;But , I am getting error &amp;quot;&lt;strong&gt;InfoPath cannot execute any view-related object model calls. The view is not ready&amp;quot;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Please let me know how to achieve this?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/57787.aspx</link><pubDate>Mon, 09 Aug 2010 11:00:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57787</guid><dc:creator>Tugce Konuklar</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57787.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=57787</wfw:commentRss><description>Hi,
i try to do same as you, but ı am extremlly new about InfoPath, and could you tell me please, where did you write this &amp;quot;code the PrintOut() function to the OnClick event of the button&amp;quot;  i don t know, how can i reach Code behind of the button on the form or list in InfoPath????????Could you explain step by step on InfoPath2010.

Thank you :)</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/56125.aspx</link><pubDate>Tue, 22 Jun 2010 19:58:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:56125</guid><dc:creator>Joemanc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/56125.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=56125</wfw:commentRss><description>&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;In case anyone needs the code...&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; FormEvents_ContextChanged(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ContextChangedEventArgs)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (e.ChangeType = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;ContextNode&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;If the data field ends up on the PrintView&amp;#39;s first field, then switch back via code to SelectExistingRecord view&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Case&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e.Context.Name&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;dppd&amp;quot; &amp;#39;this is the field that gets the focus on the print view&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.ViewInfos.SwitchView(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;SelectExistingRecord&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&amp;nbsp; &amp;#39;switch back to the view that called the Print&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Select&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/20193.aspx</link><pubDate>Fri, 25 May 2007 20:23:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20193</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20193.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=20193</wfw:commentRss><description>Brilliant! Thanks for sharing this, Shiraz. It works like a champ.&lt;br /&gt;</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2201.aspx</link><pubDate>Wed, 09 Aug 2006 16:30:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2201</guid><dc:creator>Shiraz Cupala</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2201.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2201</wfw:commentRss><description>Unfortunately InfoPath locks the view switching during this operation.  We ran into a similar view switch issue on another project and had to use a tricky workaround.  We set an onContextChange handler to pickup when the cursor was in the first field int he view and then did the switch back.  In your case this would prevent the user from ever actually going to the second view.  What you would have to do is write code to special case the onContextChange to only switch back if you were in a print state mode.  Say by setting a boolean flag or the value of a hidden DOM node to a specific value during the printing scenario.</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2200.aspx</link><pubDate>Wed, 09 Aug 2006 14:43:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2200</guid><dc:creator>plangford</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2200.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2200</wfw:commentRss><description>Try putting the switch view code after the printout code.  It will switch back to the original view.</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2199.aspx</link><pubDate>Thu, 20 Apr 2006 22:33:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2199</guid><dc:creator>rzwahr</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2199.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2199</wfw:commentRss><description>Patrick,&lt;br /&gt;I've got the printing working as you described, but I still can't figure out how to get it to switch back the view to the default view automatically (via code) after printing.  Currently as a workaround, I have a button on the print view that says "Finished printing", but it really is a stopgap - seems very "kludgey".  There has got to be a way to return to the default view by way of code.  For something seemingly so simple in a program that is very powerful, seems awful complicated.&lt;br /&gt;&lt;br /&gt;I tried creating a field and changing the value upon the click of the print button, and then tried hooking into the OnAfterChange event of that field to switch back to the default view - but I still keep getting the "view not ready" errors, even when triggering it from OnAfterChange.  This suprised me because I thought you only got those if you tried to switch views twice in the same procedure, which I am not doing (at least to my knowledge).&lt;br /&gt;&lt;br /&gt;So if the view isn't ready, how do I get it ready??? There has GOT to be a way to do this.&lt;br /&gt;&lt;br /&gt;Ryan</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2198.aspx</link><pubDate>Thu, 20 Apr 2006 14:10:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2198</guid><dc:creator>Abhishek</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2198.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2198</wfw:commentRss><description>Ryan,&lt;br /&gt;Unfortunately,I dont think what u exactly want is possible.&lt;br /&gt;U need to do as what Patrick said.&lt;br /&gt;U can have  buttons namely "Print View A" and "Print View B".&lt;br /&gt;On clicking "Print View A",switch view to "View A".&lt;br /&gt;Have a button in "View A" to Print.&lt;br /&gt;&lt;br /&gt;Similarly for the other views.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Abhishek.</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2197.aspx</link><pubDate>Thu, 20 Apr 2006 14:00:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2197</guid><dc:creator>rzwahr</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2197.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2197</wfw:commentRss><description>Patrick,&lt;br /&gt;That would solve part of my problem.  So I would:&lt;br /&gt;&lt;br /&gt;1)assign a button rule to switch the view&lt;br /&gt;2)code the PrintOut() function to the OnClick event of the button&lt;br /&gt;3)this is where I am confused - how do I switch back to the view I started from, without getting the dreaded view not ready??  Is there an event that I could tie into to issue the switchview command to switch back?  what event triggers when a view is switched, so I could say effectively "when you switch to this (print) view, print it out and switch back to the view you just came from?  How could I accomplish this?&lt;br /&gt;&lt;br /&gt;Also, if I want to print a view that is not assigned anywhere as a default print view, how would I access it to print it?  I have a view which is designed to be printed out, but it is not assigned to any particular page (it's actually a master report of all views combined), so the only way I can figure to get to it and print it, is to switch to it as a view, print it, then switch back.  Then I run into the whole view is not ready problem.  Printing a view that is defined as the default print view on any given page is easy enough, but I need to know how to also print views that are not linked defined as print views to any particular view.  I'd like to have a page that has a panel of buttons that say "Print View A", "Print View B", etc.  None of those views I want to print would be assigned anywhere as a "default print view", so I need to either print them directly, or somehow temporarily make the view in question the default print view for the page I am on while printing, so when I issue the print out command, it prints the right view.&lt;br /&gt;&lt;br /&gt;Thanks guys,&lt;br /&gt;Ryan</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2196.aspx</link><pubDate>Thu, 20 Apr 2006 04:29:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2196</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2196.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2196</wfw:commentRss><description>Hi Ryan,&lt;br /&gt;How about adding rules to your control panel buttons to switch the view and then print. The print will have to be done in code and, as Matt states, will require FT, but it's doable.</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2195.aspx</link><pubDate>Wed, 19 Apr 2006 17:25:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2195</guid><dc:creator>rzwahr</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2195.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2195</wfw:commentRss><description>Got it, thanks!&lt;br /&gt;&lt;br /&gt;I guess what I was more interested in is printing any view I want from any other given view with the click of a button, without any regard to what the default print view happens to be on that page that I am "clicking" from.  I want to be able to have a main "control panel" of buttons, where users can click buttons to print view A, or view B, etc...&lt;br /&gt;&lt;br /&gt;What I can't seem to get how to do is, to print a view via code that is not specified as the default print view from the page I am on.  I understand I can set the default print view, but I already have a default print view for that page.  I really need to know how to either print whatever view I want via code, or set the default print view via code.  I guess either would work.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Ryan</description></item><item><title>Re: Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/2194.aspx</link><pubDate>Wed, 19 Apr 2006 16:36:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2194</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2194.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2194</wfw:commentRss><description>From the Views task pane, double-click the View and switch to the Print Settings tab. From here you can set another view as the Print view.  When you press print (or issue a print command via code) while on the original view InfoPath will print the view that has been designated as the Print view.&lt;br /&gt;&lt;br /&gt;As for printing via code - the reason you are getting permission denied error is because the XDocument.PrintOut() method requires full trust.&lt;br /&gt;&lt;br /&gt;Hope this helps!</description></item><item><title>Printing a view via code</title><link>https://www.infopathdev.com:443/forums/thread/1252.aspx</link><pubDate>Wed, 19 Apr 2006 14:33:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1252</guid><dc:creator>rzwahr</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1252.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1252</wfw:commentRss><description>Is it possible to print a view within code without actually switching to that view?  I would like to have print buttons for several views along the bottom of my form, and would like the user to be able to click and print a view from anywhere.  I've tried switching views and the printing, but I get permission denied errors.  How can this be accomplished - can't I just issue a printout command and specify the view I want printed?  If you must switch views, what is the correct way this should be coded to avoid permission denied and view not ready errors?&lt;br /&gt;&lt;br /&gt;Ryan</description></item></channel></rss>