Ver código fonte

测试打印

chenrui 3 anos atrás
pai
commit
4bcd1d2f86
1 arquivos alterados com 3 adições e 12 exclusões
  1. 3 12
      src/libs/JGPrint.js

+ 3 - 12
src/libs/JGPrint.js

@@ -31,12 +31,9 @@ export const JGPrint = function (data, type, printerType) {
     if (m) m = m[1]
     LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
     // LODOP.SET_PRINT_PAGESIZE(3, '2140', '60', '') // 这里3表示纵向打印且纸高“按内容的高度”;2140表示纸宽214.0mm;60表示页底空白6.0mm
-    // LODOP.ADD_PRINT_HTM("0","0","RightMargin:0.5cm","BottomMargin:0.5cm",m)
+    // LODOP.ADD_PRINT_HTM('0', '0', 'RightMargin:0.5cm', 'BottomMargin:0.5cm', m)
     // LODOP.ADD_PRINT_TABLE(0, 0, '100%', '100%', m)
-    blobToDataURL(new Blob([data], { type: 'application/pdf' }), function (result) {
-      LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', result)
-    })
-    // LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', demoDownloadPDF(url))
+    LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new Blob([data], { type: 'application/pdf' }))
     LODOP.SET_PRINT_STYLEA(0, 'PDFScalMode', 1)
     LODOP.SET_PRINT_PAGESIZE(3, 0, 0, '')
     if (type == 'preview') {
@@ -55,13 +52,7 @@ export const JGPrint = function (data, type, printerType) {
     }
   }
 }
-export const blobToDataURL = function (blob, callback) {
-  var a = new FileReader()
-  a.readAsDataURL(blob)
-  a.onload = function (e) {
-    callback(e.target.result)
-  }
-}
+
 export const demoGetBASE64 = function (dataArray) {
   var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
   var strData = ''