Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JackZhang1994/flutter_bt_printer
Browse files Browse the repository at this point in the history
  • Loading branch information
maitianyihu committed Nov 28, 2019
2 parents 9118bb8 + 6b5aaf6 commit 5cabea8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
19 changes: 5 additions & 14 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -247,27 +247,28 @@ private boolean printCustom(String topTitle, String bottomTitle, String qrCode,
double lVerLen = 38;// 线纵向长度
double lWidth = 0.2;// 线宽度
double cVerLen = 7.6;// 单元格纵向长度
double cHorLen = 18;// 单元格横向宽度
double cHorLen = 17;// 单元格横向宽度
double qrCodeHorLen = cVerLen * 3;
double startPos = 0.2;

// 开始绘图任务,传入参数(页面宽度, 页面高度)
api.startJob(lHorLen, lVerLen, 90);
api.setItemHorizontalAlignment(IAtBitmap.ItemAlignment.CENTER);
api.setItemVerticalAlignment(IAtBitmap.ItemAlignment.CENTER);

api.drawRectangle(0, 0, lHorLen, lVerLen, lWidth);
api.drawRoundRectangle(startPos, 0, lHorLen, lVerLen, 1, 1, 0.3);

// 画横线
api.drawLine(0, cVerLen, lHorLen, cVerLen, lWidth);
api.drawLine(0, lVerLen - cVerLen, lHorLen, lVerLen - cVerLen, lWidth);
api.drawLine(startPos, cVerLen, lHorLen, cVerLen, lWidth);
api.drawLine(startPos, lVerLen - cVerLen, lHorLen, lVerLen - cVerLen, lWidth);
api.drawLine(qrCodeHorLen, 2 * cVerLen, lHorLen, 2 * cVerLen, lWidth);
api.drawLine(qrCodeHorLen, 3 * cVerLen, lHorLen, 3 * cVerLen, lWidth);
// 画竖线
api.drawLine(qrCodeHorLen, cVerLen, qrCodeHorLen, lVerLen - cVerLen, lWidth);
api.drawLine(qrCodeHorLen + cHorLen, cVerLen, qrCodeHorLen + cHorLen, lVerLen - cVerLen, lWidth);

api.drawText(topTitle, 0, 0, lHorLen, cVerLen, 3.2);
api.draw2DQRCode(qrCode, 2, cVerLen + 2, cHorLen);
api.draw2DQRCode(qrCode, 2.5, cVerLen + 2.5, 18);

api.drawText(label1Title, qrCodeHorLen, cVerLen, cHorLen, cVerLen, 2.5);
api.drawText(label1Value, qrCodeHorLen + cHorLen, cVerLen, cHorLen, cVerLen, 2.5);
Expand Down

0 comments on commit 5cabea8

Please sign in to comment.