locked
Missing characters printing webbrowser page RRS feed

  • Question

  • VB express 2010 - Windows 7 64 bit

    I just upgraded to Win 7 last week from XP Pro sp3
    Brand new machine, brand new installs of all software, hardware, etc

    One of my VB express programs opens a simple text file on my server, displays it in a browser window and then prints it to paper.
    The web pages are simple formatted text files, no graphics, etc

    The program has worked perfectly for 2 years on XP and IE8

    In Win7 64 bit and IE9, the same program drops characters randomly when printing
    It seems totally random when and where it will do this
    It may not do it again on the same exact page that it did it on before.

    Today it decided to not print the Upper case Letter K on page one and it printed upper case K's fine on the next page
    Then it did not like some other character on page 4, etc.

    It is not the printer or driver as far as I can tell
    The printer prints perfectly in Quickbooks and several other apps
    It's only my VB express program that has this strange issue

    I searched the web and found a post where someone said the page probably did not have a proper meta tag for IE9
    I added the meta tag they suggested but it did not help

    I did a forum search for missing characters and did not come up with anything.
    Anyone hear of this situation before?

    My VB express program calls a perl script that composes the web page on the fly from text files.

    Here are the two subs I call to print out the web pages
    Probably got the code here a couple years ago. :)

     'print html orders
      Private Sub PrintOrder()
        ' Create a WebBrowser instance. 
        Dim webBrowserForPrinting As New WebBrowser()
    
        ' Add an event handler that prints the document after it loads.
        AddHandler webBrowserForPrinting.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument)
    
        ' Set the Url property to load the document.
        webBrowserForPrinting.Url = New Uri(OrderURL)
      End Sub
    
      'print html orders
      Private Sub PrintDocument(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
        Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser)
    
        ' Print the document now that it is fully loaded.
        webBrowserForPrinting.Print()
    
        ' Dispose the WebBrowser now that the task is complete. 
        webBrowserForPrinting.Dispose()
      End Sub

     


    Win XP - SP3 - .net 3.5 - VB2008 Express - Exp. Web 2
    • Moved by Mike Feng Tuesday, December 27, 2011 7:06 AM IE issue (From:Visual Basic Express Edition)
    • Moved by Yanping Wang Tuesday, December 27, 2011 9:06 AM does not relate to ie development(html,css,javascript) issue (From:Internet Explorer Web Development)
    Sunday, December 25, 2011 6:51 PM

Answers

All replies

  • Hi El34,

    Welcome to the MSDN Forum.

    I have moved this thread to a dedicated forum for better support.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, December 27, 2011 7:04 AM
  • Hi El34,

    IE development forum is dedicated to discuss about web development including HTML, CSS and Script for Internet Explorer. I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum. Thanks for your understanding.

    Thanks,


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework
    Tuesday, December 27, 2011 9:06 AM
  • Hi

    Yesterday I printed out several web pages in IE9

    Two of the pages were missing a bunch of characters

    Then I printed each one out again and all the characters printed

    I have a copy of these pages I can scan as PDF's if someone wants to see an example of this strange behavior

    To recap the situtaion
    These are simple text web pages, no graphics
    Windows 7 64 bit and IE9
    It is not the printer or driver as all other apps print just fine.




    • Edited by EL34 Wednesday, December 28, 2011 11:36 AM
    Wednesday, December 28, 2011 11:33 AM
  • This issue has not been resolved

    It only happens with my Vb 2010 express program in W7 64 bit

    That is why I posted in the VB express forum and then the post was moved here

    Can anyone think of a reason that vb 2010 express programs would have a printing issues in W7 64 bit?

    This all worked correctly in XP pro

    The missing print characters only happen in Windows 7 64 bit
    My VB.net program fetches text web pages and send them to the printer very quickly and so it may have to do with the print queue??

    Just guessing because I don't know how to solve this

     

     

     

     

    Monday, January 16, 2012 3:58 PM
  • Hello.

    We have a similar problem in IE9 on Windows 7 32bit.

    All machines which have IE9 installed have the same printing problem (random missing characters, when using a webbrowser control in a hidden form written in dotnet). Machines with IE8 are printing correctly.

     

    Currently we have reinstalled IE8, since we haven’t found a solution for IE9.

     

    I think it’s an IE9 problem, not “Vb 2010 express”, since our code is compiled with vs2005 using dotnet framework v 2.

    Here is a link to other people having the same problem with IE9 and printing using the webbrowser control. 

    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/22d08dba-b3f2-44f0-ab37-430dc627fc21

    http://www.bitonwire.com/csharp-forum/strange-problem-with-webbrowser1-print_t1144.html

    No one has found a solution that works.

     

    You might add some wait time, then the problem will decrease but it will not go away.

    Tuesday, January 17, 2012 2:01 PM
  • Ah, that makes me feel better that someone knows what I am talking about

    So it's not just Windows 7 64 bit and IE9, it's also W7 32 bit and IE9
    And W7 - IE8 combo is is fine

    Hmm, I may go back to IE8

    What I ended up doing to my VB 2010 express code was to not print all the pages in a loop

    I am now viewing each page one at time and then hitting the print button in my program.

    The pages print fine when I do it this way, but it is way slower than just stacking up all the pages in the print spooler

    Thanks for the links, I'll check them out

     

     

     

    Tuesday, January 17, 2012 4:44 PM
  • Ed, there is no solution yet that I have seen.

    What Bochristenen proposed is just a band aid to get by, not a fix

    There is still a problem with the Webbrowser control and IE9 combo dropping characters when printing the pages in the webbrowser control.

    I have gone back to hitting a print button manually as each page loads into the webbrowser control

    If I stack printer pages up in a loop, the missing character problem rears it's ugly head once again.

    Tuesday, March 27, 2012 11:14 AM
  • Ed, there is no solution yet that I have seen.

    What Bochristenen proposed is just a band aid to get by, not a fix

    There is still a problem with the Webbrowser control and IE9 combo dropping characters when printing the pages in the webbrowser control.

    I have gone back to hitting a print button manually as each page loads into the webbrowser control

    If I stack printer pages up in a loop, the missing character problem rears it's ugly head once again.

    Okay. I unproposed it. So this is the "Where is" forum, and so the answer seems to be that the best place to ask is...

    VB General: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads

    VB Category: http://social.msdn.microsoft.com/Forums/en-US/category/visualbasic

    VB Express: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/threads

     

    So the answer for this forum is to try in one of those forums. However, it looks like someone moved your question into this forum (so technically you were forced into here). So I'll move this question into a specific forum if you'd like.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Monday, April 9, 2012 4:18 AM
  • Hi, I am also facing a very strange problem while printing report thru execwb method of SHDocVw.InternetExplorer interface, it was working fine untill i upgraded ie8 to ie9, but asa upgraded to ie9 it started print some junk character(A'A'A'A') in report, I tried many solution istead of execwb method tried with Webbrowser.Print method also but all are in vein, same issue resurfaced again and again, application is printing fine below ie9 verion but on ie9 its started printing some junk/garbase character.

    for execwb methos i took reference of Interop.SHDocvw.dll
    Development Environment - .Net 2.0,
    Deploy Environment: - ie9 with windows 7

     

    My Code is below

      SHDocVw.InternetExplorer ieApp = null;
             object objUnknown = new System.Runtime.InteropServices.UnknownWrapper(null);
                    ieApp = new SHDocVw.InternetExplorerClass();

                    object noValue1 = null;
                    object noValue2 = null;
                    object noValue3 = null;
                    object noValue4 = null;
                    object noValue5 = null;
                    object noValue6 = null;
                    object COMNothing = null;

                    COMNothing = new System.Runtime.InteropServices.UnknownWrapper(null);

                    noValue1 = COMNothing;
                    noValue2 = COMNothing;
                    noValue3 = COMNothing;
                    noValue4 = COMNothing;
                    noValue5 = COMNothing;
                    noValue6 = COMNothing;

                    ieApp.Navigate(URL, ref noValue1, ref noValue2, ref noValue3, ref noValue4);
                    while (ieApp.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                    {
                        Application.DoEvents();
                        Thread.Sleep(50);
                    }
                       
                        OLECMDF status = ieApp.QueryStatusWB(OLECMDID.OLECMDID_PRINT);

                        ieApp.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref noValue5, ref noValue6);
                        int count = 100;
                        while (count-- > 0)
                        {
                            Application.DoEvents();
                            Thread.Sleep(100);
                            Debug_Log.Log(4, "N", "CreateBrowser", "Sleep");
                        }


    Can you please let me know if you have any solution, any type of suggestion is most welcomed 

    Thursday, April 26, 2012 11:13 AM
  • I am still having the same issues I reported in post #1

    Still no help or proper answer

    Thursday, April 26, 2012 11:59 AM
  • Thanks EL34,

    I think then its bug in ie9, can any buddy help us out  from this issues of ie9

    Thanks

    rakesh

    Friday, April 27, 2012 3:44 AM
  • Just this morning I printed a simple text file in my vb.net program (developed using vbexpress 2010)
    The files I print are displayed in a browser window inside my vb.net app

    And here is the strange part
    All capital L letters did not print on the doument
    Lower case l's printed just fine, only capitial L's were missing
    Next time it could be  F, J R, W or all of those letters missing on one document

    The next printed document in the print queue will be perfectly fine, all those letters print perfectly fine
    I have been saving some paper examples if I can ever find anyone that has a clue and wants to see the examples. 

    Friday, April 27, 2012 10:54 AM
  • I've been doing some research on the missing characters issue.  It may be helpful to some of you: http://marc.durdin.net/2012/08/when-characters-go-astray-diagnosing.html

    Long story short: seems like a threading bug that can be resolved by serializing print jobs.  Slow but it works.  Long term: hopefully we can escalate with MS for a full solution.


    Wednesday, August 22, 2012 6:42 AM