export function createSignatureBlock() {
    pad = new SignaturePad(document.getElementById('signature_pad'));
    const ratio =  Math.max(window.devicePixelRatio || 1, 1);
    canvas.width = canvas.offsetWidth * ratio;
    canvas.height = canvas.offsetHeight * ratio;
    canvas.getContext("2d").scale(ratio, ratio);
    //pad.clear(); // otherwise isEmpty() might return incorrect value
}

export function clearSignatureBlock() {
    //const pad = new SignaturePad(document.getElementById('signature_pad'));
    pad.clear();
}

export function saveSignatureBlock() {
    //const pad = new SignaturePad(document.getElementById('signature_pad'));
    const data = pad.toData();
    document.getElementById('signature').value = data;

    return true;
}