Results 1 to 4 of 4

Thread: Webbrowser control in Winforms, showing .pdf - sort of

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Location
    Stonington, CT
    Posts
    9

    Webbrowser control in Winforms, showing .pdf - sort of

    I programmatically create a Webbrowser control in a form to show the contents of a pdf file - it works, but one thing is strange - the pdf appears in the upper-left-hand corner of the Webbrowser, using half the height and half the width of the control (it shows up with scrollbars, so it's still readable).

    In the attached image, the white area is the webbrowser control (the form background is dark gray, I didn't include much of that).Name:  WBExample.jpg
Views: 126
Size:  11.8 KB

    The fact that it's using exactly half of the height and half of the width seems to be a clue, but I can see no property or setting that would affect this. Does anyone have any ideas?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,339

    Re: Webbrowser control in Winforms, showing .pdf - sort of

    What happens if you add the control in the designer? These are the sorts of things you should be testing, to narrow down the specifics of the issue. If it works for one and not the other then you can compare the two controls and see what might be different between them.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Location
    Stonington, CT
    Posts
    9

    Re: Webbrowser control in Winforms, showing .pdf - sort of

    Quote Originally Posted by jmcilhinney View Post
    What happens if you add the control in the designer? These are the sorts of things you should be testing, to narrow down the specifics of the issue. If it works for one and not the other then you can compare the two controls and see what might be different between them.
    I tried that, as a standalone test on a different form in the same project, and got the same result. The Webbrowser control shows .html fine, using the full control real estate, but for .pdf's it's still the upper-left-hand corner. I'll try an entirely new solution/project just to verify it's not something hiding in the overall environment.

  4. #4
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    538

    Re: Webbrowser control in Winforms, showing .pdf - sort of

    in the web browser control, do you have 2 controls to manage both HTML and PDF, one for the HTML and one for the PDF?

    edit : after a bit of research, it seems that the web-browser control doesn't open directly the PDF but use an ActiveX control from Adobe or from other PDF viewer. The problem may come from that.
    Last edited by Delaney; Jan 17th, 2021 at 05:43 AM.
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)

Tags for this Thread

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