Solved WebBrowser control printpreview ugly scaling/zooming

Posted on 2009-12-26
Last Modified: 2013-11-26
The PrintPreview dialog of webbrowser control has really ugly scaling - it often shows some borders wider and some narrower, etc, the preview just looks ugly (but it prints correctly). On the other hand, the print preview directly from Internet Explorer looks great. These should be the same PrintPreview dialogs - I don't get it. How can I fix it? (And please do not bother answering if you are not sure what I'm talking about :)
Question by:JiriNovotny
    LVL 4

    Accepted Solution

    Which WebBrowser control are you referring to? The Managed code version (which is essentially a wrapper to the original ActiveX control included in the .Net Framework 1.x), or the ActiveX control itself?

    Honestly, I tried using the managed code WebBrowser control in .Net 2.0, but eventually got frustrated with it's lack of flexibility. It's nice for quick and dirty browser support in your windows applications, but if you're looking to do more than just the basics you'll soon discover that you'll need to write your own managed code wrapper to the ActiveX control... which, let me tell you isn't easy.

    That said, it wouldn't surprise me if Microsoft's managed code WebBrowser control used a different Print Preview dialog than the one used in Internet Explorer. To tell you the truth, I hadn't noticed a difference, but that could be because I wrote my own wrapper and possibly told the ActiveX control to perform its default action for the Print Preview command... which would be to bring up the Print Preview dialog of IE. I'd have to test this on Monday and get back to you because now I'm curious.

    If this turns out to be the case, and if there's a way to handle overriding just the Print Preview without having to rewrite bloody everything like I did, I'll share that too.

    Author Comment

    Eventually I figured out I can force a different version of IE renderer to be used in the print preview, which has partially fixed my problem. I also maximize the print preview window which helps. Thanks for your input.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now