[英]How can I take snap shot and convert to PDF of section of HTML page in JavaScript without any Library?
I do not know but This question might have straight forward answer that "Not Possible" ? 我不知道,但这个问题可能有直截了当的答案“不可能”? But I think definately there should be a way to do this, May be using some OS level work. 但我认为应该有办法做到这一点,可能会使用一些操作系统级别的工作。 My Question can be better understand by watching this code. 通过观看此代码可以更好地理解我的问题。
<html>
<head>
</head>
<body>
<div> .......... </div>
<div> .......... </div>
<div> .......... </div>
<div> .......... </div>
<div id="my-required-section"> .......... </div>
<div> .......... </div>
<div> .......... </div>
<div> .......... </div>
<div> .......... </div>
<div> .......... </div>
</body>
This complete html is the rendered DOM after all server side and client side code has been executed. 这个完整的html是在执行了所有服务器端和客户端代码之后呈现的DOM。 Now I have Browser view of this complete page DOM, I just want to get SnapShot of a specific part for example the Browser view of a particular div with id =
my-required-section
. 现在我有了这个完整页面DOM的浏览器视图,我只想获取特定部分的SnapShot,例如具有id =my-required-section
的特定div的浏览器视图。
In Other Word - 换句话说 -
Lets suppose take complete snapshot of this DOM from
<html>
to</html>
than crop only a part (represented by that DIV with idmy-required-section
) 让我们假设从<html>
到</html>
此DOM的完整快照,而不是只裁剪一个部分(由ID为my-required-section
DIV表示)
I will be thank full Even if you suggest me a good article related to this kind of problem. 我会感激不尽即使你向我推荐一篇与这类问题有关的好文章。
I will add more context to the problem for better understanding the problem. 我将为问题添加更多上下文,以便更好地理解问题。
Are you trying to retrieve information contained within the Document Object ? 您是否尝试检索文档对象中包含的信息 ?
If so, I would advise looking into css selectors , as they may be used to retrieve particular elements of a web page. 如果是这样,我会建议查看css选择器 ,因为它们可能用于检索网页的特定元素。 In your example, you may retrieve the selected element using document.getElementById("my-required-section");
在您的示例中,您可以使用document.getElementById("my-required-section");
检索所选元素document.getElementById("my-required-section");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.