locked
Printing from an asp.net page not working correctly on the server RRS feed

  • Question

  • User914775649 posted

    The code seems to work on the development box but not once it's deployed on the server it just hangs. I'm also wanting to know how to add a method to show all users printers instead of just printing to the default printer.

    protected void Button1_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += new PrintPageEventHandler(pqr);
            pd.Print();
    
        }
        void pqr(object o, PrintPageEventArgs e)
        {
    
            System.Net.WebClient client = new System.Net.WebClient();
            System.IO.Stream stream = client.OpenRead("http://www.petstarseattle.com/images/Coupons/petStarSeattle_Promtional_Coupon.gif");
            System.Drawing.Image i = System.Drawing.Image.FromStream(stream);
            Point p = new Point(100, 100);
            e.Graphics.DrawImage(i, p);
            stream.Close();
            client.Dispose();
    
        }
    


     

    Saturday, May 8, 2010 4:39 PM

Answers

  • User-1659704165 posted

    Hi,

    Your Code will Work on Server But Won't Work With Client....
    use Window.Print() if u want on clinet

    http://www.quackit.com/javascript/javascript_print.cfm

    http://www.javascriptkit.com/howto/newtech2.shtml


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 9, 2010 2:03 AM

All replies