import getLodop from "../assets/js/LodopFuncs";

function printProof(content, barcode_params = {}) {
    var param_name_arr = Object.getOwnPropertyNames(barcode_params);
    //打印结果
    let LODOP = getLodop()
    // LODOP.SET_LICENSES("", "E747A5AADCE82E2F32B6D0DC83E34146", "", "");
    LODOP.ADD_PRINT_HTM(1, 1, 700, "95%", content)

    // 有条码参数 需要单独打印条码
    if (param_name_arr.length != 0) {
        var top = barcode_params.top
        var left = barcode_params.left
        var width = barcode_params.width
        var height = barcode_params.height
        var type = barcode_params.type
        var code = barcode_params.code
        LODOP.ADD_PRINT_BARCODE(top, left, width, height, type, code);//设置条码位置、宽高、字体、值
        LODOP.SET_PRINT_STYLEA(0, "FontSize", 6);//设置上面这个条码下方的文字字体大小
        LODOP.SET_PRINT_STYLEA(0, "AlignJustify", 2);//设置条码下方的文字相对于条码本身居中
    }

    LODOP.SET_PRINT_STYLEA(0, "HOrient", 3);
    LODOP.SET_PRINT_STYLEA(0, "VOrient", 3);
    LODOP.SET_PRINT_PAGESIZE(3, 800, 0, "");
    LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);//文本框里 内容对于文本框居中
    LODOP.SET_PRINTER_INDEX('YBJS');//指定虚拟打印机
    // LODOP.GET_PRINTER_NAME("BTP-U62V")
    // LODOP.PRINT();
    // LODOP.PRINTA();
    LODOP.PREVIEW();
}


export default printProof;