PageScale = 10
PageHeight = 101.6 * PageScale '4" x 6.5" AIAG Label Size
PageWidth = 152.4 * PageScale
'Page& = _NEWIMAGE(PageWidth, PageHeight, 32)
'_DEST Page&: CLS , _RGB(255, 255, 255): _DEST 0 'make background white to save ink!
CursorPosY = 0
'INPUT "PART NUMBER: ", part$
'INPUT "QUANTITY : ", quantity$
'INPUT "PO NUMBER : ", po$
'INPUT "REV NUMBER : ", revision$
'INPUT "SERIAL NUM : ", serial$
'INPUT "DESCRIPTION: ", description$
'INPUT "VENDOR CODE: ", vendor$
'PrintTextBold Page&, 12, " PART #"
'PrintTextBold Page&, 12, " CUST (P)"
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, " QUANTITY"
'PrintTextBold Page&, 12, " (Q)"
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, " PO # (K) REV # (ENG #) (2P)"
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, " SERIAL # PART DESCRIPTION"
'PrintTextBold Page&, 12, " MASTER (4S)"
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, ""
'PrintTextBold Page&, 12, " VENDOR #(SUPPLIER ID)(V)"
'PrintTextBold Page&, 30, " MASTER LABEL"
'SCREEN Page&
Prev&
= _NewImage(650, 400, 32) 'print preview
Input "Save Label (Y/N)?", i$
'show print preview SaveImage Page&, "imageoutput2.bmp"
Input "Print Label (Y/N)?", i$
'print screen page on printer
Sub PrintText
(Page&
, PointSize
, text$
) FontHeight
= Int(PointSize
* 0.3527 * PageScale
) FontHandle
= _LoadFont("c:\windows\fonts\monos.ttf", FontHeight
) Color _RGB(0, 0, 0), _RGBA(0, 0, 0, 0) 'black text on clear background _Font 16 'change to the QB64 default font to free it CursorPosY = CursorPosY + FontHeight 'adjust print position down
Sub PrintBarcode
(Page&
, PointSize
, text$
) FontHeight
= Int(PointSize
* 0.3527 * PageScale
) 'FontHandle = _LOADFONT("c:\windows\fonts\idautomationhc39m free version.ttf", FontHeight)
FontHandle
= _LoadFont("c:\windows\fonts\archon code 39 barcode.ttf", FontHeight
) 'FontHandle = _LOADFONT("c:\windows\fonts\code39azalea.ttf", FontHeight)
'FontHandle = _LOADFONT("c:\windows\fonts\free3of9.ttf", FontHeight)
'FontHandle = _LOADFONT("c:\windows\fonts\connectcode39_s3.ttf", FontHeight)
Color _RGB(0, 0, 0), _RGBA(0, 0, 0, 0) 'black text on clear background _Font 16 'change to the QB64 default font to free it CursorPosY = CursorPosY + FontHeight 'adjust print position down
Sub PrintTextBold
(Page&
, PointSize
, text$
) FontHeight
= Int(PointSize
* 0.3527 * PageScale
) FontHandle
= _LoadFont("c:\windows\fonts\monosb.ttf", FontHeight
) Color _RGB(0, 0, 0), _RGBA(0, 0, 0, 0) 'black text on clear background _Font 16 'change to the QB64 default font to free it CursorPosY = CursorPosY + FontHeight 'adjust print position down
If bytesperpixel&
= 1 Then bpp&
= 8 Else bpp&
= 24 b$
= "BM????QB64????" + MKL$(40) + MKL$(x&
) + MKL$(y&
) + MKI$(1) + MKI$(bpp&
) + MKL$(0) + "????" + String$(16, 0) 'partial BMP header info(???? to be filled later) For c&
= 0 To 255 ' read BGR color settings from JPG image + 1 byte spacer(CHR$(0)) Mid$(b$
, 11, 4) = MKL$(Len(b$
)) ' image pixel data offset(BMP header) For py&
= y&
- 1 To 0 Step -1 ' read JPG image pixel color data r$ = ""
c&
= Point(px&
, py&
) 'POINT 32 bit values are large LONG values d$ = d$ + r$ + padder$
Mid$(b$
, 35, 4) = MKL$(Len(d$
)) ' image size(BMP header) b$ = b$ + d$ ' total file data bytes to create file
Mid$(b$
, 3, 4) = MKL$(Len(b$
)) ' size of data file(BMP header)