<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/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>Web Forms</title><link>http://forums.asp.net/18.aspx</link><description>All about building ASP.NET Pages - server controls, events, validation, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/311780.aspx</link><pubDate>Mon, 18 Aug 2003 08:45:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:311780</guid><dc:creator>aw13</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/311780.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=311780</wfw:commentRss><description>Hi there,
&lt;br /&gt;
I've tried ur codes but it prints the page displayed on screen instead of printing the page inside the IFRAME. Do u have any idea why? Thanks alot.</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268799.aspx</link><pubDate>Sun, 06 Jul 2003 12:43:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268799</guid><dc:creator>firoz.ansari</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268799.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268799</wfw:commentRss><description>There is little modification in the above code
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
 var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;';
&lt;br /&gt;
 document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
 WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
 WebBrowser1.outerHTML = &lt;b&gt;fraDocument.document.body.innerHTML&lt;/b&gt;;
&lt;br /&gt;
 return false;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;
I have tested the above code and its working perfectly.</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268740.aspx</link><pubDate>Sun, 06 Jul 2003 06:41:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268740</guid><dc:creator>firoz.ansari</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268740.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268740</wfw:commentRss><description>Yes! I am sure the same code can be use to print document located at the server.
&lt;br /&gt;
What you have to do is to put one IFRAME (that should be invisible) in the page. and set the src of that IFRAME to the document url which is located at the server.
&lt;br /&gt;

&lt;br /&gt;
IFRAME can be make invisible by setting its HEIGHT and WIDTH to 0.
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
&amp;lt;iframe id=&amp;quot;fraDocument&amp;quot; style=&amp;quot;WIDTH: 0px; HEIGHT: 0px&amp;quot; src=&amp;quot;document1.htm&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;
Now
&lt;br /&gt;
Modify the previous javascript code as
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = fraDocument.innerHTML;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
Though I didnt test above &amp;quot;hypothesis&amp;quot;  :) . But I am sure that above approach will work.
&lt;br /&gt;
Please let me know if you have succeed in printing server docuement without &amp;quot;displaying&amp;quot; it on the browser.
&lt;br /&gt;

&lt;br /&gt;
Regards</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268735.aspx</link><pubDate>Sun, 06 Jul 2003 06:09:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268735</guid><dc:creator>dotnettergirl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268735.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268735</wfw:commentRss><description>works great !  now I have an additional question - can this same code be used so that a document located on the server can be printed, or is different code required to do so? how can that be done?</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268724.aspx</link><pubDate>Sun, 06 Jul 2003 05:36:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268724</guid><dc:creator>firoz.ansari</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268724.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268724</wfw:commentRss><description>Modify the code as 
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
&lt;br /&gt;
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
&lt;br /&gt;
	Submit.Attributes.Add(&amp;quot;onclick&amp;quot;, &amp;quot;return PrintIt();&amp;quot;) 
&lt;br /&gt;
End Sub
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&amp;lt;script&amp;gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = &amp;quot;Test Content&amp;quot;;
&lt;br /&gt;
	return false;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;
PrintIt() is the javascript function. So it must NOT run with the runat=&amp;quot;server&amp;quot;.</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268580.aspx</link><pubDate>Sat, 05 Jul 2003 20:04:07 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268580</guid><dc:creator>dotnettergirl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268580.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268580</wfw:commentRss><description>I think I am starting to understand now. But I am getting an error on the &amp;quot;{&amp;quot; line:
&lt;br /&gt;

&lt;br /&gt;
Compiler Error Message: BC30035: Syntax error.
&lt;br /&gt;
Source Error:
&lt;br /&gt;
Line 5:  
&lt;br /&gt;
Line 6:  function PrintIt()
&lt;br /&gt;
Line 7:  { 
&lt;br /&gt;

&lt;br /&gt;
My code is as follows (and thank you for your help so far):
&lt;br /&gt;

&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
&amp;lt;%@ Page Explicit=&amp;quot;True&amp;quot; Language=&amp;quot;VB&amp;quot; Debug=&amp;quot;True&amp;quot; %&amp;gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;
&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
&lt;br /&gt;
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
&lt;br /&gt;
	Submit.Attributes.Add(&amp;quot;onclick&amp;quot;, &amp;quot;return PrintIt();&amp;quot;) 
&lt;br /&gt;
End Sub
&lt;br /&gt;

&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = &amp;quot;Test Content&amp;quot;;
&lt;br /&gt;
	return false;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;
&lt;br /&gt;
&amp;lt;form&amp;gt;
&lt;br /&gt;
WEB PAGE CONTENT
&lt;br /&gt;
&amp;lt;asp:imagebutton id=&amp;quot;Submit&amp;quot; imageurl=&amp;quot;submit.gif&amp;quot; runat=&amp;quot;server&amp;quot; /&amp;gt;
&lt;br /&gt;
&amp;lt;/form&amp;gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
 
&lt;br /&gt;</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268538.aspx</link><pubDate>Sat, 05 Jul 2003 18:32:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268538</guid><dc:creator>firoz.ansari</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268538.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268538</wfw:commentRss><description>You need to set one attribute in the Page_Load event of the page
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
&lt;br /&gt;
Submit.Attributes.Add(&amp;quot;onclick&amp;quot;, &amp;quot;return PrintIt();&amp;quot;) 
&lt;br /&gt;
End Sub
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;
And modifiy ASPX file script as
&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = &amp;quot;Test Content&amp;quot;;
&lt;br /&gt;
	return false;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;

&lt;br /&gt;
With that remove &lt;b&gt;onclick=&amp;quot;Submit_Click&amp;quot;&lt;/b&gt; event from the Submit button
&lt;br /&gt;
I am sure this will work now</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268527.aspx</link><pubDate>Sat, 05 Jul 2003 18:23:28 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268527</guid><dc:creator>dotnettergirl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268527.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268527</wfw:commentRss><description>I have never used the web broser object before, so when I tried it, I couldnt get it to work. Ive included my code below, which is just supposed to print the Test Content when the submit button is clicked. Can you please point me in the right direction? Thanks !
&lt;br /&gt;

&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;

&lt;br /&gt;
&amp;lt;%@ Page Explicit=&amp;quot;True&amp;quot; Language=&amp;quot;VB&amp;quot; Debug=&amp;quot;True&amp;quot; %&amp;gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;
&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = &amp;quot;Test Content&amp;quot;;
&lt;br /&gt;
}  
&lt;br /&gt;
&amp;lt;/script&amp;gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;
&lt;br /&gt;
&amp;lt;form&amp;gt;
&lt;br /&gt;
WEB PAGE CONTENT
&lt;br /&gt;
&amp;lt;asp:imagebutton id=&amp;quot;Submit&amp;quot; imageurl=&amp;quot;submit.gif&amp;quot; onclick=&amp;quot;Submit_Click&amp;quot; runat=&amp;quot;server&amp;quot; /&amp;gt;
&lt;br /&gt;
&amp;lt;/form&amp;gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;/pre&gt;</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268518.aspx</link><pubDate>Sat, 05 Jul 2003 17:59:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268518</guid><dc:creator>dotnettergirl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268518.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268518</wfw:commentRss><description>how do i get it to do the same thing, but provide the print dialog box?</description></item><item><title>Re: Printing a document without viewing</title><link>http://forums.asp.net/thread/268460.aspx</link><pubDate>Sat, 05 Jul 2003 15:30:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268460</guid><dc:creator>firoz.ansari</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268460.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268460</wfw:commentRss><description>You just have to embed WebBrowser object into the page. Here is the code for that. It will not promt user for any print dialog box and will print the document to the default page. 
&lt;br /&gt;

&lt;br /&gt;
&lt;pre&gt;
&lt;br /&gt;
function PrintIt()
&lt;br /&gt;
{ 
&lt;br /&gt;
	var WebBrowser = '&amp;lt;OBJECT ID=&amp;quot;WebBrowser1&amp;quot; WIDTH=0 HEIGHT=0 CLASSID=&amp;quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;quot;&amp;gt;&amp;lt;/OBJECT&amp;gt;;';
&lt;br /&gt;
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
&lt;br /&gt;
	WebBrowser1.ExecWB(6, -1); 
&lt;br /&gt;
	WebBrowser1.outerHTML = &amp;quot;Test Content&amp;quot;;
&lt;br /&gt;
}
&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
Through above code you can achieve print the content which is not displayed on the browser. In above case its &amp;quot;Test Content&amp;quot;.
&lt;br /&gt;

&lt;br /&gt;
Change the value of the outerHTML property based on the content you want to print. Please NOTE that it will not prompt for any print dialog box. It will simply print the content to the default printer.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
Regards, 
&lt;br /&gt;

&lt;br /&gt;
Firoz
&lt;br /&gt;</description></item><item><title>Printing a document without viewing</title><link>http://forums.asp.net/thread/268206.aspx</link><pubDate>Fri, 04 Jul 2003 22:49:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:268206</guid><dc:creator>dotnettergirl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/268206.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=268206</wfw:commentRss><description>I have a document that I want to print, but I dont want to display it on the screen, but just give its name or something. How do I send the command to process this request? Please help !</description></item></channel></rss>