Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to save a webpage to a jpeg

How to save a webpage to a jpeg

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kozu
    wrote on last edited by
    #1

    Hi, I have a winForm that hosts a webcontrol. Is there any way I can save the page displayed by the control to jpg? thanx

    N 1 Reply Last reply
    0
    • K kozu

      Hi, I have a winForm that hosts a webcontrol. Is there any way I can save the page displayed by the control to jpg? thanx

      N Offline
      N Offline
      Nuri Ismail
      wrote on last edited by
      #2

      Did you try DrawToBitmap()[^] method?

      K 1 Reply Last reply
      0
      • N Nuri Ismail

        Did you try DrawToBitmap()[^] method?

        K Offline
        K Offline
        kozu
        wrote on last edited by
        #3

        I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx

        L N 2 Replies Last reply
        0
        • K kozu

          I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          last time I did that with a WebBrowser, the image was black, not blank!? And no, I haven't found a solution yet (I haven't been looking very hard either). :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Happy New Year to all.
          We hope 2010 soon brings us automatic PRE tags!
          Until then, please insert them manually.


          1 Reply Last reply
          0
          • K kozu

            I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx

            N Offline
            N Offline
            Nuri Ismail
            wrote on last edited by
            #5

            Hi, Apparently using DrawToBitmap on WebBrowser control works only for some sites. [^] I also found this[^], which might help you. But i haven't tried it yet. Regards,

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups