Over Killer
Over Killer

Reputation: 513

Awesomium incorrectly prints pages to PDF

Why Awesomium incorectly prints web sites to PDF? This is my code:

   private void _browser_LoadingFrameComplete(object sender, Awesomium.Core.FrameEventArgs e)
    {
        _Status.Content = "Printing to pdf...";
        WebControl tempControl = sender as WebControl;
        tempControl.WebSession.Views.First().PrintToFile("E:\\", PrintConfig.Default);
        _Status.Content = "Done.";
    }

Result of following code is under that link (http://google.pl): Link to dropbox

As You can see a lot of elements looks like are partially loaded. How to resolve this? Is someone experiencing similar issue?

Upvotes: 1

Views: 490

Answers (1)

beppe9000
beppe9000

Reputation: 1114

You have to check if the frame that has just been loaded is actually the page, and not any other thing.

To do that, make an If check for e.IsMainFrame=true, then you can happily print.

Beware that some pages could load things via AJAX, so if you rely on the LoadingFrameComplete event you could get spinning wheels instead of content.

Upvotes: 1

Related Questions