How to save a rendered webpage as image with JavaScript?

前端 未结 3 2155
有刺的猬
有刺的猬 2020-12-08 21:23

In my app I have to provide a \'save as image\' button. I want to save the HTML rendered on my webpage as an image in JavaScript. It is a webapp and will be used in browsers

3条回答
  •  囚心锁ツ
    2020-12-08 21:49

    Your question is very incomplete. First, is that a mobile or desktop app? In both cases, the solution to your problem will strongly depend on the HTML engine that renders the pages: Webkit, Geko/Firefox, Trident/IE for example have their own method to produce the view that you want to save as an image.

    Anyway, you could start looking at how this Firefox plugin works: https://addons.mozilla.org/it/firefox/addon/pagesaver/

    It should do what you want to implement, look for its source code.

提交回复
热议问题