-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
插件渲染的页面预览完整,但是无论导出图片还是到剪贴板都是只有框架和空白 #90
Comments
tweet 是 iframe 渲染的,暂时我没什么办法处理这种情况, #85 已经提到过这个问题了。 |
预览部分的图为什么是对的呢?如果预览的地方是对的,可以使用其他方法得到这个图片。 |
预览展示的是还是 dom,并不是图片,在导出时,还要把这个 dom 转成图片,还会有一层转换逻辑 |
我查到的信息,不知道是否可行。 <html>
<head>
<script src="html2canvas.min.js"></script>
<script src="jspdf.umd.min.js"></script>
</head>
<body>
<iframe id="capture" src="https://example.com" style="width: 100%; height: 600px;"></iframe>
<button onclick="createPdf()">Create PDF</button>
<script>
function createPdf() {
html2canvas(document.getElementById('capture')).then(canvas => {
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF();
pdf.addImage(imgData, 'PNG', 0, 0);
pdf.save("output.pdf");
});
}
</script>
</body>
</html> |
这涉及到跨域问题,同域的 iframe 应该是可行的,但 obsidian 里嵌入的网页肯定是跨域的,没有权限读取 iframe 里的内容。 |
我用插件 Multi-Column Markdown 设计的页面,里面是一些tweet,渲染如下:
您的插件预览也正确:
但是就是导出和黏贴到剪贴板都是空白的。
The text was updated successfully, but these errors were encountered: