0

我正在尝试使用 SignaturePad - 捕获签名 - 原始编码有效 - 但它会弹出到新浏览器并作为 data:image/png;base64etc 发送...

这很好 - 但我正在尝试将数据捕获到 .cfm url - 即:signed.cfm?sigstr="data:image/png;base64etc..." - 然后我可以用它做事。更改网址没有太多运气 - 也没有新的浏览器窗口 - 我认为它是下面的代码......

window.open(signaturePad.toDataURL());

任何帮助表示赞赏

 var wrapper = document.getElementById("signature-pad"),
clearButton = wrapper.querySelector("[data-action=clear]"),
saveButton = wrapper.querySelector("[data-action=save]"),
canvas = wrapper.querySelector("canvas"),
signaturePad;

 // Adjust canvas coordinate space taking into account pixel ratio,
 // to make it look crisp on mobile devices.
 // This also causes canvas to be cleared.
 function resizeCanvas() {
// When zoomed out to less than 100%, for some very strange reason,
// some browsers report devicePixelRatio as less than 1
// and only part of the canvas is cleared then.
var ratio =  Math.max(window.devicePixelRatio || 1, 1);
canvas.width = canvas.offsetWidth * ratio;
canvas.height = canvas.offsetHeight * ratio;
canvas.getContext("2d").scale(ratio, ratio);
 }

 window.onresize = resizeCanvas;
 resizeCanvas();

 signaturePad = new SignaturePad(canvas);

 clearButton.addEventListener("click", function (event) {
signaturePad.clear();
 });

 saveButton.addEventListener("click", function (event) {
if (signaturePad.isEmpty()) {
    alert("Please provide signature first.");
} else {
    window.open(signaturePad.toDataURL());
}
 });
4

0 回答 0