Javascript library to take screenshot of web page

流过昼夜 提交于 2020-01-13 20:30:35

问题


This similar question was asked a long time a ago (4 years ago). I was wondering if there are any new advancements in the library ecosystem.

My use case is quite simple, I have a styled DIV and some elements within - I'd like to create a screenshot of that DIV.

Takes this:                                            Into this:
----------------------------                           ------------------------
<div class="potrait">
    <img src="sergio.jpg" />   --> Turns it into -->   sergio.png
    <h1>Sergio tapia</h1>
</div>

Is there anything out there that can help me achieve this?


回答1:


You have two possibilities:

  1. rerender the div with a lib like html2canvas
  2. Render it on a server

Taking a real screenshot from js is not possible.



来源:https://stackoverflow.com/questions/13520390/javascript-library-to-take-screenshot-of-web-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!