HttpPrinter Yi Bridge Network Printer

HttpPrinter Yi Bridge Network Printer

Download:
https://www.lanzous.com/b743805

I. Overview:
Methods commonly used to print the report include:
1. Use activex print but can only be used in IE, but Microsoft has abandoned IE, chrome a single large, the new version of EDGE are open source kernel with chrome
2. generation but the efficiency and print pdf printing restrictions. you try to batch print data, do not kill you, generate a pdf, click print their own time.
3. js pass data to the report server, compatible with a variety of browsers.
4. Andrews IOS custom printer, or interface used printer.

So many prints, can unite. This is what we use now HttpPrinter, through Http communication, set up printer server template format to send data to the server.

Second, characteristics:
1, no plug-ins, the main one js can;
2, drag to complete the design, sharp waves thanks for the support the report, the pride of the people;
3, powerful reporting capabilities, to hell with the report, cross, nested, or two-dimensional code, images, etc., are supported.
4, printer: as long as the use of printers are supported, dot matrix printers, laser printers, a small ticket printers, card printers, etc., not in words next, and when you have multiple printers can specify the printer;
5, supports a variety of languages, java php js delphi python ios andriod, etc., to provide communications support Http language.

Third, the use preconditions:
1, before printing, the need to design a good print report
2, format of the print data is transmitted to the print server must Json, and the data must meet the specified format (see below);

Fourth, the data format Note:
The following report data to a data format as an example to explain;

{
"ReportName": the encodeURIComponent ( "test.grf"), / report filename /
"the Copies": 1, / optional. Number of copies, supports the specified number of copies. 1 part by default, if zero is not printed, return only pdf report generation, jpg and other documents /
"PrinterName": the encodeURIComponent ( ""), / optional. Specify the printer, is empty, then use the default printer, in Control Panel -> Devices and Printers in view the name of your printer /
"PrintOffsetX": 0, / optional. Right offset printing, in centimeters. Offset in the horizontal direction of the report, to the right as positive, negative to the left. /
"PrintOffsetY": 0, / optional. Under offset printing, in centimeters. Offset in the vertical orientation of the report, positive downward, negative direction. /
"Token": the encodeURIComponent ( "AA"), / * optional. As long as the token value to print them in the list

  "Control": encodeURIComponent('['  ///*部件框,可选值:AsStaticBox ,AsMemoBox,AsRichTextBox,AsPictureBox (base64格式),AsBarcode*/
    +'{"type": "AsStaticBox", "name": "姓名","value": "高文杰","required": false},'
    +'{"type": "AsStaticBox", "name": "性别","value": "男","required": false},'
    +'{"type": "AsStaticBox", "name": "电话","value": "13165191728","required": false},'
    +'{"type": "AsBarcode", "name": "二维码","value": "5520002701774727","required": false},'
    +'{"type": "AsPictureBox", "name": "图片","value": "/j9KKKKACiiigAooooA/9k=","required": false},'  //base64格式
    +']'),

  "Parameter": encodeURIComponent('['  ///*参数,type 默认为空即可,已经在报表端设置了 备用字段  
    +'{"type": "", "name": "单号","value": "5520002701774727","required": false},'
    +'{"type": "", "name": "日期","value": "2019-09-09 12:21:12","required": false},'
    +'{"type": "", "name": "year","value": "2018","required": false},'
    +']'),

  "Field": encodeURIComponent('['  ///*字段, type ftBlob (base64格式) ,ftString ftInteger ftBoolean, ftFloat, ftCurrency,ftDateTime,  size (ftString 设置为实际长度,其他的设置为0,例如 ftInteger ftBlob 等设置为0 ) 
    +'{"type": "ftString", "name": "快递单号","size": 255,"required": true},'
    +'{"type": "ftString", "name": "发件人","size": 255,"required": false},'
    +'{"type": "ftString", "name": "发件人电话","size": 255,"required": false},'
    +'{"type": "ftBlob", "name": "图像","size": 0,"required": false},'
    +']'),

  "Data": encodeURIComponent('['  ///*数据行  
    +'{"快递单号": "1234567890", "发件人": "张三","发件人电话": "13100110000"},'
    +'{"快递单号": "1234567890", "发件人": "李四","发件人电话": "13100110001"},'
    +'{"快递单号": "1234567890", "发件人": "王五","发件人电话": "13100110002"},'
    +'{"快递单号": "1234567890", "发件人": "马六","发件人电话": "13100110003"},'
    +'{"快递单号": "1234567890", "发件人": "赵七","发件人电话": "13100110004"},'
    +'{"快递单号": "1234567890", "发件人": "钱八","发件人电话": "13100110005"},'
    +']'),

}


Successful return { "status": "ok", "data": "report address"}, else return { "status": "error", "data": "specific error"}

Guess you like

Origin blog.51cto.com/7166940/2402990