html2canvas无法下载

时间:2018-07-04 07:08:05

标签: javascript html

我下面的代码包含一个简单的 - name: <name> image: <image> env: - name: KUBERNETES_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name html页面,我正在尝试使用库hello world来尝试下载画布,但是它似乎无法正常工作按照我看到的教程,但它不起作用,我在下面做错了吗?任何帮助将不胜感激。

html2canvas
function sendData() {
    html2canvas(document.getElementById('capture')).then(function (canvas) {
            $('#capture').append(canvas);
            $('#match-button').attr('href', canvas.toDataURL('image/png'));
            $('#match-button').attr('download', 'Test.png');
            $('#match-button')[0].click();
        });
    }

1 个答案:

答案 0 :(得分:1)

首先。如果 test 是某个元素的ID,则jQuery语法要求在之前。

DSN = 'dbname=test'

## don't modify anything below this line (except for experimenting)

class SimpleQuoter(object):
    def sqlquote(x=None):
        return "'bar'"

import sys
import psycopg2

if len(sys.argv) > 1:
    DSN = sys.argv[1]

print("Opening connection using dsn:", DSN)
conn = psycopg2.connect(DSN)
print("Encoding for this connection is", conn.encoding)

curs = conn.cursor()
curs.execute("SELECT 1 AS foo")
print(curs.fetchone())
curs.execute("SELECT 1 AS foo")
print(curs.fetchmany())
curs.execute("SELECT 1 AS foo")
print(curs.fetchall())

conn.rollback()

sys.exit(0)

curs.execute("SELECT 1 AS foo", async=1)

curs.execute("SELECT %(foo)s AS foo", {'foo':'bar'})
curs.execute("SELECT %(foo)s AS foo", {'foo':None})
curs.execute("SELECT %(foo)f AS foo", {'foo':42})
curs.execute("SELECT %(foo)s AS foo", {'foo':SimpleQuoter()})

然后,不推荐使用html2canvas rendered 选项。改用then()方法,如官方网站https://html2canvas.hertzen.com/所述。我无法从问题中的html代码段中找到 test 元素,因此我在匹配按钮之后添加了它。修改后的代码如下:

#include <iostream>
#include <STEPControl_Reader.hxx>
#include <string>

using namespace std;


int main() {

STEPControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile("C:\\Users\\Kelevradesktop.Kelevra-desktop\\Desktop\\Studienarbeit\\steptest.step");
IFSelect_PrintCount mode = IFSelect_ListByItem;
reader.PrintCheckLoad(false, mode);

Standard_Integer NbRoots = reader.NbRootsForTransfer();                      //Transfer whole file
Standard_Integer num = reader.TransferRoots();

Standard_Integer NbTrans = reader.TransferRoots();
TopoDS_Shape result = reader.OneShape();
TopoDS_Shape shape = reader.Shape();


cout << NbRoots << endl;
cout << NbTrans << endl;
cout << num << endl;

system("pause");

return 0;
}