Results 1 to 4 of 4

Thread: [Resolved][2.0]Force print in web browser control

Threaded View

  1. #1

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    [Resolved][2.0]Force print in web browser control

    I have a file in html that I need to open and print.

    It doesn't print and it doesn't show the print dialog.

    Is the problem likely to be related to the fact that I never
    actually display the browser control on the screen?
    I kinda want this to be done behind the scenes.

    It gets the path and converts it correctly, (i.e. c://thisfolder becomes c:/thisfolder like it should)


    Code:
    public void PrintFile()
            {
                //Create a new IE control
                System.Windows.Forms.WebBrowser myBrowser = new System.Windows.Forms.WebBrowser();
                //Load it with file
                Uri myURL = new Uri(GetDefaultPath() + "PrintThisFile.html");
                myBrowser.Navigate(myURL);
                myBrowser.Refresh();
    
                //Print it
                myBrowser.ShowPrintPreviewDialog();
                myBrowser.Print();
                //close and clean up
                myBrowser.Dispose();
    
            }//PrintFile()
    Last edited by JPicasso; Aug 1st, 2006 at 07:02 AM.
    Merry Christmas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width