We help IT Professionals succeed at work.
Get Started

Print webpage from windowsform in c#

solarissf
solarissf asked
on
1,370 Views
Last Modified: 2013-12-16
Hello All,

Stuck on this and driving me crazy.

The end goal is to print an email in lotus notes automatically.  Already found the universalID of specific email.

Now I am trying to return url as a webpage through a proxy(using UNIVERSAL ID) and print it.  Due to fact that no matter what I try I cannot get lotusnotes to print it automatically.

I've been able to retreive webpage, but its the javascript I believe.

I am looking to print what the view is as if you looked at the website and hit print.  Not the code behind it.  

If I put the results of what I found in a form txtbox I only see the script of the webpage.

any ideas?

    public void FindWebPage()
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.msn.com");
        WebProxy myproxy = new WebProxy("http://autoproxy:81", false);
        myproxy.BypassProxyOnLocal = false;
        request.Proxy = myproxy;
        request.Method = "GET";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();


        System.IO.Stream _WebStream = response.GetResponseStream();
        var reader = new StreamReader(_WebStream);
        string text = reader.ReadToEnd();
        txtEmailTest.Text = text;

Open in new window


here is the output
// Prudential Internet Access Services, report problem to SPOC @ 1-888-PRU-PRU9
// Dynamic Automatic Proxy Config - PLEASE DO NOT MODIFY
// Configuration Generated at Mon May 16 18:17:14 2011 UTC - proxy.pac : default
// Client IP: 48.27.193.68 | BROWSER:  | Region: default
ftpProxyAll    = "PROXY " + "48.19.199.100:8080"   + "; PROXY " + "48.135.149.100:8080" ;
gopherProxyAll = "PROXY " + "48.19.199.100:8080"   + "; PROXY " + "48.135.149.100:8080" ;
httpProxyAll   = "PROXY " + "48.19.199.100:8080"   + "; PROXY " + "48.135.149.100:8080" ;
httpsProxyAll  = "PROXY " + "48.19.199.100:8080"   + "; PROXY " + "48.135.149.100:8080" ;
trustProxyAll  = "PROXY " + "48.113.204.143:8080" + "; PROXY " + "48.114.150.143:8080" ;
internalProxyAll = "PROXY " + "" + "; PROXY " + "" ;
function FindProxyForURL(url, host) {
      if ( isPlainHostName(host) )
            return "DIRECT";
        else if ( localHostOrDomainIs(host, "prudential.your-locator.com") ||
          localHostOrDomainIs(host, "pruhomes.prudential.com") ||
        shExpMatch(host, "207.87.15.28") ||
          localHostOrDomainIs(host, "www.vicinity.com") ||
          localHostOrDomainIs(host, "myhr-ess.prudential.com") ||
          localHostOrDomainIs(host, "prudential.vicinity.com") ||
          localHostOrDomainIs(host, "www.geoaccess.com") ||
          localHostOrDomainIs(host, "advantage.prudential.com") ||
          (localHostOrDomainIs(host, "www.ups.com") && 
           (url.substring(0, 5).toLowerCase() == "http:")) ||
          (localHostOrDomainIs(host, "wwwapps.ups.com") && 
           (url.substring(0, 5).toLowerCase() == "http:")) ||
          (localHostOrDomainIs(host, "www.dhl.com") && 
           (url.substring(0, 5).toLowerCase() == "http:")) ||
          localHostOrDomainIs(host, "www.fedex.com")  ||
          localHostOrDomainIs(host, "www.axi.americanexpress.com") ||
          localHostOrDomainIs(host, "www.cibt.com") ||
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE